AcceleratorDjango

From TextUsers

Jump to: navigation, search

Contents

Django Accelerator Setup

Upgrade packages

  #Update the catalog, else the next command may not do much
  sudo pkg-get -U

  #Update installed packages according to the catalog
  yes | sudo pkg-get upgrade

Install mod_python and MySQLdb (Python bindings)

 sudo pkg-get -i ap2_modpython
 sudo pkg-get -i pymysql

Install Django

 cd ~
 svn co http://code.djangoproject.com/svn/django/trunk/ django_src
 sudo ln -s `pwd`/django_src/django /opt/csw/lib/python2.3/site-packages/django
 sudo ln -s `pwd`/django_src/django/bin/django-admin.py /opt/csw/bin/django-admin.py

Add these lines to ~/.bashrc:

 alias python='/opt/csw/bin/python2.3'
 export PYTHONPATH=.:/opt/csw/lib/python2.3/site-packages/

Then run:

 rehash

Setup Web user and group

 sudo groupadd web 
 sudo useradd -g web -s /usr/bin/bash -d /opt/csw/apache2/vhosts/ web
 sudo passwd web
 cd /opt/csw/apache2/                                                                                             
 sudo mkdir vhosts
 sudo chown web:web vhosts

Setup Apache

Note: For new accelerators you may be able to skip this step, and just edit /opt/csw/apache2/etc/virtualhosts/*.conf --rsimplicio 20:11, 17 July 2007 (UTC)

In /opt/csw/apache2/etc/httpd.conf uncomment:

 Include etc/extra/httpd-vhosts.conf

Add a Virtual Host to /opt/csw/apache2/etc/extra/httpd-vhosts.conf:

 <VirtualHost *:80>
     DocumentRoot /opt/csw/apache2/vhosts/example.com/
     ServerName example.com
     ServerAlias www.example.com test.example.com
     ServerAdmin webmaster@example.com
     ErrorLog var/log/example.com-error_log
     CustomLog var/log/example.com-access_log common
     <Directory "/opt/csw/apache2/vhosts/example.com/">
         allow from all
         Options -Indexes
     </Directory>
     <Location "/media/">
         SetHandler None
     </Location>
     SetHandler python-program
     PythonHandler django.core.handlers.modpython
     SetEnv DJANGO_SETTINGS_MODULE djangoproject.settings
     PythonDebug Off
 </VirtualHost>

Install Django Application

Put the Django application in the /opt/csw/lib/python2.3/site-packages/ directory.

Restart Apache

 sudo apachectl restart
Personal tools