Code Monkey home page Code Monkey logo

django-amp-tools's Introduction

django-amp-tools

https://travis-ci.org/shtalinberg/django-amp-tools.svg?branch=develop

django-amp-tools ( amp_tools ) provides a simple way to work with Accelerated mobile pages (AMP) in django and gives you tools at your hand to render some different templates to deliver an AMP version of your site to the user.

The initial idea, which has guided the development of this application from django-mobile app, is to keep your views exactly the same but to transparently interchange the templates used to render a response.

This is done in two steps:

  1. A middleware determines the client's preference to view your site. E.g. if he wants to use the AMP or the standart version.
  2. The template loader takes then care of choosing the correct templates based on the GET param detected in the middleware.

Installation

Pre-Requirements: django-amp-tools depends on django's sites framework. So before you try to use django-amp-tools make sure that the sites framework is enabled and working.

  1. Install django-amp-tools with your favourite python tool, e.g. with easy_install django-amp-tools or pip install django-amp-tools.
  2. Add amp_tools to your INSTALLED_APPS setting in the settings.py.
  3. Add amp_tools.middleware.AMPDetectionMiddleware to end of your MIDDLEWARE_CLASSES setting.
  4. Add amp_tools.loader.Loader as first item to your loaders list for TEMPLATES setting in settings.py.

Usage

See docs/usage.rst

Documentation is available online, or in the doc directory of the project.

The source code for this app is hosted at https://github.com/shtalinberg/django-amp-tools.

Pull requests are welcome. See <http://django-amp-tools.readthedocs.io/en/latest/contributing.html>`_.

django-amp-tools's People

Contributors

shtalinberg avatar sstoops avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.