Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add syntax highlighting #39

Merged
merged 4 commits into from Jan 26, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 18 additions & 6 deletions README.rst
Expand Up @@ -28,7 +28,9 @@ Overview
Say you have an app called ``myapp`` with a few defaults, which you want
to refer to in the app's code without repeating yourself all the time.
``appconf`` provides a simple class to implement those defaults. Simply add
something like the following code somewhere in your app files::
something like the following code somewhere in your app files:

.. code-block:: python

from appconf import AppConf

Expand All @@ -51,7 +53,9 @@ setting is located at. E.g. if your ``models.py`` with the ``AppConf`` class
is in the ``myapp`` package, the prefix of the settings will be ``MYAPP``.

You can override the default prefix by specifying a ``prefix`` attribute of
an inner ``Meta`` class::
an inner ``Meta`` class:

.. code-block:: python

from appconf import AppConf

Expand All @@ -66,13 +70,17 @@ an inner ``Meta`` class::

The ``MyAppConf`` class will automatically look at Django's global settings
to determine if you've overridden it. For example, adding this to your site's
``settings.py`` would override ``SETTING_1`` of the above ``MyAppConf``::
``settings.py`` would override ``SETTING_1`` of the above ``MyAppConf``:

.. code-block:: python

ACME_SETTING_1 = "uno"

In case you want to use a different settings object instead of the default
``'django.conf.settings'``, set the ``holder`` attribute of the inner
``Meta`` class to a dotted import path::
``Meta`` class to a dotted import path:

.. code-block:: python

from appconf import AppConf

Expand All @@ -88,7 +96,9 @@ In case you want to use a different settings object instead of the default

If you ship an ``AppConf`` class with your reusable Django app, it's
recommended to put it in a ``conf.py`` file of your app package and
import ``django.conf.settings`` in it, too::
import ``django.conf.settings`` in it, too:

.. code-block:: python

from django.conf import settings
from appconf import AppConf
Expand All @@ -101,7 +111,9 @@ import ``django.conf.settings`` in it, too::

In the other files of your app you can easily make sure the settings
are correctly loaded if you import Django's settings object from that
module, e.g. in your app's ``views.py``::
module, e.g. in your app's ``views.py``:

.. code-block:: python

from django.http import HttpResponse
from myapp.conf import settings
Expand Down