Skip to content

Instantly share code, notes, and snippets.

@vishwassharma
Last active December 23, 2015 15:09
Show Gist options
  • Save vishwassharma/6654145 to your computer and use it in GitHub Desktop.
Save vishwassharma/6654145 to your computer and use it in GitHub Desktop.
Django Hosting
AddHandler fcgid-script .fcgi
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^static/(.*)$ static/$1 [QSA,L]
RewriteCond %{REQUEST_URI} !(myproject.fcgi)
RewriteRule ^(.*)$ myproject.fcgi/$1 [QSA,L]
#!/usr/bin/python2.6
from traceback import format_exc
import sys
import os
import site
# Make sure to change 'username' to your username!
# sys.path.insert(0, '/home/vish0wass/local/lib/python2.6/site-packages')
try:
site.addsitedir('/home/vishwass/local/lib/python2.6/site-packages')
site.addsitedir('/home/vishwass/website')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
except Exception:
open("/home/vishwass/website/lot.txt", "w").write(format_exc())
raise
#!/usr/local/bin/python2.7
import sys, os
home_path = "/home/content/t/e/c/techbudconsult/"
pyenv_path = "pyenv/lib/python2.7/site-packages"
file_path = "swarjneeti/myproject"
log_path = "swarjneeti/lot.txt"
sys.path += [os.path.join(home_path, pyenv_path)]
sys.path += [os.path.join(home_path, file_path)]
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()
chmod 644 .htaccess
chmod 744 dispatch.fcgi
chmod 600 settings.py
chmod 600 local_settings.py
#!/usr/local/bin/python2.7
from traceback import format_exc
import sys, os
import site
try:
site.addsitedir("/home/content/t/e/c/techbudconsult/pyenv/lib/python2.7/site-packages")
site.addsitedir("/home/content/t/e/c/techbudconsult/swarjneeti/meravote")
# Add a custom Python path for your project
#sys.path.insert(0, "/home/content/t/e/c/techbudconsult/swarjneeti/meravote")
# Set the DJANGO_SETTINGS_MODULE environment variable.
# This should match the name for the project you added to the path above
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
except Exception:
open("/home/content/t/e/c/techbudconsult/swarjneeti/lot.txt", "w").write(format_exc())
raise
AddHandler fcgid-script .fcgi
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# everything else sent to django
RewriteRule ^(dispatch.py/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.py/$1 [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment