Browse files

Add settings management API doc; update other pages to refer to it wh…

…ere appropriate.
  • Loading branch information...
1 parent 5fcd17e commit 1abbe354959fa305106196d452e565e05d12e8a8 @rfreebern rfreebern committed Jun 14, 2012
Showing with 50 additions and 17 deletions.
  1. +5 −0 getting-started/installation.rst
  2. +5 −17 getting-started/upgrading.rst
  3. +1 −0 userguide/index.rst
  4. +39 −0 userguide/settings.rst
@@ -78,6 +78,11 @@ You can now view the dev server at http://localhost:8000/ -- hooray!
If you start adding pieces that should go back into playdoh, you will probably
want to patch `funfactory`_, which is the core of Playdoh.
+If your app's configuration requires you to add or remove apps, middleware, or
+template context processors from the default funfactory configuration, you can
+use the ``get_apps``, ``get_middleware``, and ``get_context_processors``
+functions. See the :ref:`settings management API <settings>` documentation.
.. _funfactory:
.. _`MySQL`:
@@ -39,33 +39,19 @@ Applying Playdoh to an existing Django app is a little different than
+ INSTALLED_APPS = get_apps(append=(...))
Do the same for any other lists which have been customized.
This will ensure that you inherit the default funfactory settings.
- You can remove any entries in ``INSTALLED_APPS`` from your ````
- if they are already in ```` by using the utility
- function ``get_apps`` from funfactory's ````::

kumar303 Jun 14, 2012


If you turn on autodoc (below) then you can do :func:get_apps`` and it will create a link directly to the signature definition of each function.

- from funfactory.utils import get_apps
- INSTALLED_APPS = get_apps(exclude=(
- 'django.contrib.auth',
- 'django_sha2'
- ))
- Similar functions ``get_middleware`` and ``get_template_context_processors``
- exist to help manage ``MIDDLEWARE_CLASSES`` and
+ See the :ref:`settings management API <settings>` for information about
+ funfactory's built-in settings management functions, including ``get_apps``.
#. You can remove any redundant settings in ```` if they appear in
.. _`funfactory from PyPI`:
-.. _manual-upgrae:
Mind those monkey patches
@@ -80,6 +66,8 @@ See the :ref:`Monkey patches <monkeypatches>` documentation for the
lines you need to add to your root if you don't already have
+.. _manual-upgrade:
Manual upgrade
@@ -15,3 +15,4 @@ User Guide
+ settings
@@ -0,0 +1,39 @@
+.. _settings:
+Settings Management API
+Funfactory's default settings module provides some useful helper functions that
+make managing your playdoh app's settings easier.

kumar303 Jun 14, 2012


by magic, if you put these lines, the docs will be built from the docstrings of each function:

.. autofunction:: funfactory.settings_base.get_apps

.. autofunction:: funfactory.settings_base.get_middleware

.. autofunction:: funfactory.settings_base.get_template_context_processors

We might have to turn autodoc on in docs/


rfreebern Jun 14, 2012


I tried to use autodoc but it wanted to actually import settings_base from funfactory, which depends on all sorts of other stuff. At some point it felt impractical to keep trying to get that working rather than just write it myself.


kumar303 Jun 14, 2012


Try adding this to

import os
from funfactory import manage
manage.setup_environ(os.path.join(os.path.dirname(__file__), '..', ''), more_pythonic=True)

That should put vendor on the path and everything else you need. You may also need os.environ('DJANGO_SETTINGS_MODULE', 'project.settings') but try it first without

+* ``get_apps(exclude=(), append=())``
+ The ``get_apps`` function returns the current INSTALLED_APPS tuple, modified
+ based on the ``exclude`` and ``append`` parameters, which can be tuples or
+ lists. INSTALLED_APPS originates in funfactory's ```` file,
+ containing the default suite of funfactory apps, but can be modified using
+ this function to add or remove apps as necessary for your project.
+ The state of the INSTALLED_APPS tuple returned by this function persists so
+ that you can modify it as necessary for your app in ``settings/``
+ and then further modify it for your local install in ``settings/``.
+ Example::
+ INSTALLED_APPS = get_apps(
+ exclude=('cronjobs', 'djcelery'),
+ append=('debug_toolbar',)
+ )

kumar303 Jun 14, 2012


You can move this (reST formatting and all) to the docstring after autodoc'ing

+* ``get_middleware(exclude=(), append=())``
+ Similar to ``get_apps``, this function returns the current
+ MIDDLEWARE_CLASSES tuple and persists its state through the various
+ settings files.
+* ``get_template_context_processors(exclude=(), append=())``
+ Again, similar to ``get_apps`` but returns the current
+ TEMPLATE_CONTEXT_PROCESSORS tuple and persists its state through the various
+ settings files.

0 comments on commit 1abbe35

Please sign in to comment.