From ddd1113b12b8fb183e173762d8c7d021ce21d846 Mon Sep 17 00:00:00 2001 From: James Hiew Date: Wed, 7 Dec 2016 22:02:47 +0000 Subject: [PATCH] Update installation documentation Fixes #305 Fixes #229 --- docs/installation.rst | 49 +++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index bab7e4708a..a37f58f114 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -14,15 +14,19 @@ Configuration --------------- -Add ``djstripe`` to your ``INSTALLED_APPS``: +Add ``djstripe`` to your ``INSTALLED_APPS``. You will also need the `sites` framework enabled.: .. code-block:: python + SITE_ID = 1 + INSTALLED_APPS += [ + 'django.contrib.sites', + # ..., "djstripe", ] -Add your stripe keys: +Add your Stripe keys: .. code-block:: python @@ -69,40 +73,45 @@ Add some payment plans: `DJSTRIPE_PLANS` setting, use an `OrderedDict` from the `collections` module in the standard library, rather than an ordinary dict. -Add to the urls.py:: +Add the following to the `urlpatterns` in your `urls.py` to expose payment views and the webhook endpoint: + +.. code-block:: python url(r'^payments/', include('djstripe.urls', namespace="djstripe")), -Run the commands:: +.. note:: Using the inbuilt dj-stripe views - python manage.py migrate + There must be a `base.html` template on your template loader path with `javascript` and `content` blocks present + for the dj-stripe views' templates to extend. - python manage.py djstripe_init_customers + .. code-block:: html - python manage.py djstripe_init_plans + {% block content %}{% endblock %} + {% block javascript %}{% endblock %} -If you haven't already, add JQuery and the Bootstrap 3.0.0+ JS and CSS to your base template: + If you haven't already, add JQuery and the Bootstrap 3.0.0+ JS and CSS to your base template as well: -.. code-block:: html + .. code-block:: html - - + + - - + + - - + + - - + + -Also, if you don't have it already, add a javascript block to your base.html file: +Run the commands:: -.. code-block:: html + python manage.py migrate - {% block javascript %}{% endblock %} + python manage.py djstripe_init_customers + python manage.py djstripe_init_plans Running Tests --------------