short intro:
- i'm talking about django project but use case should be relevant for
any wsgi app
- i'm using virtualenv/pip to install packages from private pypi
(python libraries, django apps, ...) for this project
- the only thing that isn't installed via virtualenv/pip is django
project (settings.py, urls.py and similar), it's updated from source
repository (using git)
my goal:
1) create python package for django project and install it via pip
(this also removes any git usage in project deployment)
2) configure django project/wsgi app via apache wsgi script
#1 is pretty simple so no questions about that.
my solution for #2 is to define in <PROJECT NAME>.wsgi:
----------------------------------------
PROJECT_SETTINGS = {
'PROJECT_ROOT': PROJECT_ROOT,
'DATABASE_ENGINE': 'sqlite3',
'DATABASE_NAME': os.path.join(PROJECT_ROOT, 'dev.db'),
}
for k,v in PROJECT_SETTINGS.iteritems():
os.environ["DJANGO_%s" % k] = v
os.environ['DJANGO_SETTINGS_MODULE'] = 'wsgi_app.settings'
----------------------------------------
and then handle this in wsgi app (in my case django project
settings.py) using something like:
----------------------------------------
for k,v in os.environ.iteritems():
if k != "DJANGO_SETTINGS_MODULE" and k.startswith("DJANGO_"):
key = k[7:]
locals()[k] = v
----------------------------------------
can you recommend a better way? any ideas/tips are appreciated.
Aljosa Mohorovic
p.s.
feel free to tell me i'm an idiot, i can handle it. just recommend a
better way to do this...
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.