Thursday, June 23, 2011

Awesome Free Django Hosting: Alwaysdata

There aren't many sites that do a good job of hosting free Django services. Alwaysdata, however does a fantastic job. Here's a quick way to set your project up.
-get a free 10MB account
-place Django Project in the www directory
-add .htaccess to www director(see below)
-add django.fcgi file (see below)


AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
view raw .htaccess hosted with ❤ by GitHub
#!/usr/bin/python
import os, sys
#change ALWAYSDATASUBDIRECTORYNAME
#change labcon3 to the name of the django project folder
_PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, "/home/ALWAYSDATASUBDIRECTORYNAME/python")
sys.path.insert(0, _PROJECT_DIR)
sys.path.insert(0, os.path.dirname(_PROJECT_DIR))
sys.path.insert(0, _PROJECT_DIR)
sys.path.insert(0, os.path.join(_PROJECT_DIR, 'labcon3'))
_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]
os.environ['DJANGO_SETTINGS_MODULE'] = "labcon3.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
view raw django.fcgi hosted with ❤ by GitHub

1 comment:

  1. free django python web hosting list at http://freedjangohosting.com

    ReplyDelete