Django, Apache and mod_wsgi on Ubuntu 10.04 (Lucid) | Deployment

Set the Hostname

Before you begin installing and configuring the components described in this guide, please make sure you’ve followed our instructions for setting your hostname. Issue the following commands to make sure it is set properly:

hostname
hostname -f

The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).
Continue reading

Advertisements

ISPConfig 3.0.5 with Django 1.4, Virtualenv and WSGI on Ubuntu 12.04

I recently go a killer deal on my office >.< . I want something to easily manage my apache configs, dns and mail still and have used ISPConfig in the past and found it pretty good for a free open source program. I actually like it better than cPanel or DirectAdmin which I find too restrictive. 😛

Moving my Django projects from Webfaction will take a bit of work. ISPConfig has some nice options in the GUI for PHP but the Python option uses mod_python :(.

This will not be a complete guide but as usual some documentation for myself. It assumes that ISPConfig is already setup and working, there is an decent setup guide in docs/INSTALL_DEBIAN_6.0_courier_mydns.txt and some older but still useable docs here http://www.howtoforge.com/perfect-server-debian-lenny-ispconfig3.

“First you need to install some additional packages”
apt-get install python-setuptools libapache2-mod-wsgi python-dev -y
easy_install pip
pip install virtualenv

Then you need to setup your site in ISPConfig and copy your Django project to it or start a new one. For simplicity we will just create a new one here :

cd /var/www/mysite.com/web
virtualenv myproject-env
source /myproject-env/bin/activate

when you install pip install mysql-python you must ready to install depedencies from mysql, libmysqlclient-dev maybe the mysql_config is not in your path.

pip install mysql-python
pip install PIL
pip install django
django-admin.py startproject mysite

This will create a wsgi.py file in myproject/myproject/wsgi.py

Then in your ISPConfig Site go to Sites > Website > mysite.com > Options and in the Apache Directive add the following. Make sure to change the path to the correct absolute path.

Alias /media/ /var/www/clients/client0/web1/myproject/myproject/media/
Alias /static/ /var/www/clients/client0/web1/myproject/myproject/static/
Continue reading