Version 1 (modified by Chris Moffitt <chris.moffitt@…>, 10 years ago) (diff)

Initial draft of thinkhost install

Setting up Django on Thinkhost

Control Panel Setup

  • Use the Thinkhost control panel to make sure that fcgi is enabled on your domain.
Manage Domains -> -> Edit -> Enable Fast-CGI: Enable
  • Use the control panel to create your MySQL username and password as well as any databases you may want to use.

Command Line Configuration

  • ssh into your account
  • Create a directory to store Django
mkdir tools
cd tools
  • Checkout the latest version of django into the tools directory
svn co django_src
  • Create a directory for flup and checkout the latest source into the tools directory
svn co flup

  • Create ~/ as shown below. Make sure to put in the correct paths.
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/usr/home/www/yourusername/")
sys.path.insert(0, "/usr/home/www/yourusername/")
# Switch to the directory of your project. (Optional.)

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "yourproject.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
  • Create ~/ as shown below.
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteRule ^/(media.*)$ /$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(shop.*)$ /cgi-bin/mysite.fcgi/$1 [QSA,L]
RewriteRule ^(admin.*)$ /cgi-bin/mysite.fcgi/$1 [QSA,L]
  • Create links to the admin media directory so the data will be served up when we go to the admin site.
ln -s /usr/home/www/yourusername/
Back to Top