Skip to content

Commit

Permalink
[Documentation] Add few things in the readme file (fixes SteelSeries#1).
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbestigrou committed Jul 8, 2018
1 parent 202e9aa commit 318987b
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
django-segment
==============
This a project to setup segment with django.

How to install
==============
Use pip:

.. code-block:: bash
pip install django-segment
Or use a requirement file.

Settings
========
You must configure few things like the segment write key. You can configure
four variable in your settings file, the SEGMENT_WRITE_KEY, SEGMENT_DEBUG,
SEGMENT_SEND and SEGMENT_ON_ERROR, SEGMENT_WRITE_KEY is required others is
optional. For example:

.. code-block:: python
DEBUG = True
SEGMENT_WRITE_KEY = 'my_write_key'
SEGMENT_DEBUG = DEBUG
Template
========
First add the context processors in your settings:

.. code-block:: python
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'segment.context_processors.segment'
],
},
},
]
Then you can include the segment template in your base template:

.. code-block:: django
{% include "_segment.html" %}
Enjoy folks.

0 comments on commit 318987b

Please sign in to comment.