This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
forked from buchanae/basket
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alex Buchanan
committed
Jun 4, 2010
1 parent
0ef1c85
commit fda0495
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
import site | ||
from datetime import datetime | ||
|
||
# Remember when mod_wsgi loaded this file so we can track it in nagios. | ||
wsgi_loaded = datetime.now() | ||
|
||
# Add the zamboni dir to the python path so we can import manage. | ||
wsgidir = os.path.dirname(__file__) | ||
site.addsitedir(os.path.abspath(os.path.join(wsgidir, '../'))) | ||
|
||
# manage adds /apps, /lib, and /vendor to the Python path. | ||
import manage | ||
|
||
import django.conf | ||
import django.core.handlers.wsgi | ||
import django.core.management | ||
import django.utils | ||
|
||
# Do validate and activate translations like using `./manage.py runserver`. | ||
# http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html | ||
utility = django.core.management.ManagementUtility() | ||
command = utility.fetch_command('runserver') | ||
command.validate() | ||
|
||
# This is what mod_wsgi runs. | ||
django_app = django.core.handlers.wsgi.WSGIHandler() | ||
|
||
def application(env, start_response): | ||
env['wsgi.loaded'] = wsgi_loaded | ||
return django_app(env, start_response) | ||
|
||
# Uncomment this to figure out what's going on with the mod_wsgi environment. | ||
# def application(env, start_response): | ||
# start_response('200 OK', [('Content-Type', 'text/plain')]) | ||
# return '\n'.join('%r: %r' % item for item in sorted(env.items())) | ||
|
||
# vim: ft=python |