Django app for easy embedding of the Mailchimp subscription form to AMP pages.
Install django-mailchimp-amp:
pip install django-mailchimp-ampor from sources
pip install git+https://github.com/letme/django-mailchimp-amp
Add django-mailchimp-amp to INSTALLED_APPS in your Django settings.py. Also make sure you add your MailChimp api key, username and listids
INSTALLED_APPS = [ ... 'django-mailchimp-amp', ] MAILCHIMP_API = 'yourmailchimpapikey' MAILCHIMP_USERNAME = 'yourmailchimp@mail' MAILCHIMP_LISTID = 'mailchimplistid'
Add django-mailchimp-amp to urlpatterns in your project urls.py:
urlpatterns = [ ... path('mailchimp/', include('django-mailchimp-amp.urls')), ]
Add template tags to your templates where you want subscription form to be presented:
<head> <!-- if you did not include amp-form and amp-mustache for anything else --> {% include "django-mailchimp-amp/scripts_form.html" %} <style amp-custom> /* Include default form style template */ {% include "django-mailchimp-amp/style_form.css" %} </style> </head> <body> <!-- Include the subscription form where pre_subscribe_text appears above/before the subscription form --> {% include "django-mailchimp-amp/subscribe_form.html" with mailchimp_pre_subscribe_text="If you want to receive our awesome stuff you can subscribe to our newsletter:" %} </body>
Any contribution is welcome as well as reporting issues/bugs or requesting features. Do not be shy and open a pull request and I will do my best to help you include your contribution into the repository. Keep in mind that reporting a bug or requesting a feature is also considered as contribution, even if you do not have development skills to implement it.
To run tests and checks we use tox.
# to install tox pip3 install tox # to run tests tox