Python and Django Environment on Production
July 13th, 2006 posted by Bender Rodríguez
wherein we chronicle the battles waged to secure a foothold in the production environment for python and django
in the beginning there was only a barebones install of python 2.3. since we were starting from scratch, i decided to install python 2.4 along side 2.3, into the /usr/local/ directory. that way, all system software that depends on 2.3 (and there's a shitload, including yum) can still use it and we'll use 2.4 for our apache environment. compiling and building python 2.4 was a piece of cake (it took longer to read the README file to find out that there was really nothing special to do in our case):
./configure
make
make install
for mod_python, i had to set up my python environment to now use the 2.4 install rather than the 2.3. this meant, changing my .bashrc file to force /usr/local/bin to have precidence over /usr/bin . so i changed my $PATH variable to:
PATH=/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/sbin:$JAVA_HOME/bin:/d2/django_src/django/bin:$PATH:.
and PYTHONPATH now reads:
PYTHONPATH=/usr/local/lib/python2.4:/usr/local/lib/python2.4/site-packages:/d2/django_src:/d2/django_projects
mod_python was equally easy to compile and build:
./configure --with-apxs=/usr/sbin/apxs
make
make install
sweet. just copy the new mod_python.so file to the apache module directory and voila.
the good folks at mod_python provided us with a python.conf file in /etc/httpd/conf.d/ so we are good to go with the actual site config file. as we are hosted in a plesk environment, i had to create the vhost.conf file using the plesk tools and then add our python and django incantations there. after including our python environment for django in vhost.conf and a restart, i can see that mod_python is working properly, as it is complaining about missing libraries that are of course not installed yet (mainly django source and our project code).
MySQLdb was also a painless install:
tar xfz MySQL-python-1.2.1.tar.gz
cd MySQL-python-1.2.1
edit site.cfg if necessary
python setup.py build
sudo python setup.py install
no fuss no muss.
the remainder of the tasks involved installing the requisite python packages, which i shall list here for posterity:
Markdown 1.5
PIL 1.1.5
PIL turns out to be a major pain in the butt to install.
0 Comments,
0 trackbacks
(
Trackback URL)