Note: MySQL-python
is the mysql module, psycopg2
is the postgresql module. Depending on your needs you may choose to leave these modules out.
$ pip install django==1.8.7
$ pip install flup==1.0.2
cd ~ && virtualenv -p /usr/bin/python2.7 djangoenv
source ~/djangoenv/bin/activate
pip install flup6 paste fastcgi MySQL-python psycopg2
AddHandler fcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.fcgi/$1 [QSA,L]
app.fcgi
- replace file paths with the correct locations. Ensure this file has permissions 755:#!/home/your_username/djangoenv/bin/python2.7
import sys, os
# Add a custom Python path.
sys.path.insert(0, "/home/user/python")
# Switch to the directory of your project. (Optional.)
# os.chdir("/home/user/myproject")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")