Skip to main content

django-amp-tools

https://travis-ci.org/shtalinberg/django-amp-tools.svg?branch=develop https://img.shields.io/pypi/v/django-amp-tools.svg https://img.shields.io/pypi/pyversions/django-amp-tools.svg https://img.shields.io/badge/django-1.11%20or%20newer-green.svg

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>`_.

Metadata

Release files for django-amp-tools 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-amp-tools 0.2.2
File Size Uploaded Provenance
django-amp-tools-0.2.2.tar.gz 22.6 kB Without provenance Details

Release files / django-amp-tools-0.2.2.tar.gz

Download URL django-amp-tools-0.2.2.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
492c0cebf4da0d3e4f00bbbde687985e98085e4c76821db435ab17d7a19c7ced
BLAKE2b-256 checksum
How to use checksums
f2dd131e1d698f4aefc44070068766c32850c6b01c3cac5a2587cbb14a440a62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Security for django-amp-tools 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page