/django-mailchimp-amp

Mailchimp subscription wrapper on AMP for Django

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

GPL3 License Pypi packaged release Build status Documentation Code Coverage Maintainability Requirements Status Contributions welcome

Django Mailchimp AMP embedded subscription form

Django app for easy embedding of the Mailchimp subscription form to AMP pages.

Quick start

  1. Install django-mailchimp-amp:

    pip install django-mailchimp-amp

    or from sources

    pip install git+https://github.com/letme/django-mailchimp-amp
  2. 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'
  3. Add django-mailchimp-amp to urlpatterns in your project urls.py:

    urlpatterns = [
        ...
        path('mailchimp/', include('django-mailchimp-amp.urls')),
    ]
  4. 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>

Contributing

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.

Development setup

To run tests and checks we use tox.

# to install tox
pip3 install tox

# to run tests
tox