Django AMP(Accelerated Mobile Pages) Tools¶
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 idea (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:
- A middleware determines the client’s preference to view your site. E.g. if he wants to use the AMP or the standart version.
- The template loader takes then care of choosing the correct templates based on the GET param detected in the middleware.
The source code for this app is hosted at https://github.com/shtalinberg/django-amp-tools.
Contents:
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.
- Install
django-amp-tools
with your favourite python tool, e.g. witheasy_install django-amp-tools
orpip install django-amp-tools
. - Add
amp_tools
to yourINSTALLED_APPS
setting in thesettings.py
. - Add
amp_tools.middleware.AMPDetectionMiddleware
to end of yourMIDDLEWARE_CLASSES
setting. - Add
amp_tools.loader.Loader
as first item to yourloaders
list forTEMPLATES
setting insettings.py
.
Contributing¶
Here are the steps needed to set up a development and testing environment.
WARNING
This app use git flow for branching strategy and release management.
Please, change code and submit all pull requests into branch develop
Thanks for contributing, and have fun!
Source code and contacts¶
Repository and bugs¶
The source code for this app is hosted on https://github.com/shtalinberg/django-amp-tools.
To file bugs and requests, please use https://github.com/shtalinberg/django-amp-tools/issues.