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
- Template tag - list punctuation for a list of items by shapiromatron 10 months, 1 week ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 2 weeks ago
- Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
- Help text hyperlinks by sa2812 1 year, 6 months ago
Comments
Please login first before commenting.