2degrees/django-pastedeploy-settings — pull request #2 by pansen (2014-04-22 12:07:54+00:00)
Title: - patch to recognize django variables right from the ``DEFAULTS`` sectio...

thanks for your lib, we like it! :)

i discovered an issue if you have this config::

# Default values for all apps
# Can be overridden within the app-section with: ``set var=value``
[DEFAULT]
debug = false
django_settings_module = inventorum.api.settings
admin_email = tech@inventorum.com
STATIC_URL = "/static/"
VAR_ROOT = %(here)s/../../var

# http://pythonpaste.org/deploy/#composite-applications
[composite:main]
use = egg:Paste#urlmap
/ = inventorum_api_app

# main app
[app:inventorum_api_app]
use = egg:inventorum.api#api_main

set debug = true
TEMPLATE_DEBUG = ${debug}
SESSION_COOKIE_DOMAIN = "127.0.0.1"

in ``setup.py`` of our application i have::

#!/usr/bin/env python
from setuptools import setup, find_packages

entry_points = """\
[paste.app_factory]
api_main = inventorum.api:make_api_application

and the matching bootstrap function looks like this::

def make_api_application(global_config, **local_conf):

# Do something before importing Django and your settings have been applied.
log.debug('create django wsgi app ...')
app = get_configured_django_wsgi_app(global_config, **local_conf)

# Do something right after your application has been set up (e.g., add WSGI middleware).
# http://rhodesmill.org/brandon/2011/wsgi-under-cherrypy/

debug_flag = global_config['debug'] == 'true' or False
log.debug('add ErrorMiddleware with debug: %s ...', debug_flag)
app = ErrorMiddleware(app, debug=debug_flag)
log.debug('add TransLogger with debug: %s ...', debug_flag)
app = TransLogger(app, setup_console_handler=debug_flag)
return app

now without this patch, the settings variable ``VAR_ROOT`` will not get published to djangos settings as it probably should (at least in my case).

are you fine with that, any other requirements or did i do something wrong?

best, andi