Tuesday, September 4, 2012

Install Django on Debian6 (preparing for LousyOperator)


http://library.linode.com/frameworks/django-apache-mod-wsgi/debian-6-squeeze


Configure Django Applications for WSGI

In order for mod_wsgi to be able to provide access to your Django application, you will need to create a django.wsgi file inside of your application directory. For the purposes of this example, we assume that your application will be located outside of your DocumentRoot in the directory /srv/www/ducklington.org/application. Modify this example and all following examples to conform to the actual files and locations used in your deployment.
File:/srv/www/ducklington.org/application/django.wsgi
import os
import sys

sys.path.append('/srv/www/ducklington.org/application')

os.environ['PYTHON_EGG_CACHE'] = '/srv/www/ducklington.org/.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
You must append the path of your application to the system path as above. Additionally, declaration of the PYTHON_EGG_CACHE variable is optional but may be required for some applications when WSGI scripts are executed with the permissions of the web server. Finally, the DJANGO_SETTINGS_MODULE must refer to the Django settings.py file for your project. You will need to restart Apache after modifying the django.wsgi file.








No comments:

Post a Comment