Login

Django app WSGI

Author:
ofalk
Posted:
June 9, 2009
Language:
Python
Version:
1.0
Tags:
wsgi
Score:
2 (after 2 ratings)

If you want to have your wsgi as general as possible (for eg. different environments) without any hardcoded paths, this example might help you...

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
1   	import os
2  	import sys
3  	
4  	os.environ['DJANGO_SETTINGS_MODULE'] = 'YOURAPP.settings'
5  	
6  	project=os.path.dirname(__file__)
7  	app=os.path.dirname(project)
8  	
9  	sys.path.append(project)
10  	sys.path.append(app)
11  	
12  	from YOURAPP import settings
13  	
14  	import django.core.handlers.wsgi
15  	application = django.core.handlers.wsgi.WSGIHandler()

More like this

  1. Middleware that fixes URLs generation for admin and {% url %} for SCGI and WSGI by dottedmag 8 years ago
  2. Log to syslog by fylb 5 years, 5 months ago
  3. Integrating Django with ToofPy by Siddhi 8 years ago
  4. fabric wsgi deployment strategy by hedde 9 months, 1 week ago
  5. How to rename processes by diverman 3 years, 9 months ago

Comments

Please login first before commenting.