Ubuntu 13.10 based Python/Django/WSGI setup

I am currently looking into the use of Django for one of my extra-curricular projects and needed to set up a development environment on Ubuntu. This is the log for future reference and hopefully useful for anybody needing to do the same. Dependencies & Django Installation Core Dependencies & Django sudo apt-get install apache2 apache2-mpm-itk libapache2-mod-wsgi mysql-server python-django python-mysqldb Optional add-ons For my purposes I need a few more additional modules sudo apt-get install python-networkx python-imaging python-pythonmagick python-markdown python-textile python-docutils python-pymongo To test the installation you can check with this command that should print the Django version python -c "import django; print(django.get_version())" Django App Configuration cd /home/USERNAME/projects/python django-admin startproject djangotest cd djangotest python manage.py runserver This should give something like the following as output: Django version 1.5.4, using settings 'djangotest.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. WSGI Configuration All that remains to be configured is the Apache VHOST configuration containing the WSGI directives. sudo vim /etc/apache2/sites-available/001-djangotest.conf <VirtualHost *:80> ServerName djangotest ServerAdmin webmaster@domain.com #<IfModule mpm_itk_module> #AssignUserID USERNAME USERNAME #</IfModule> DocumentRoot /home/USERNAME/projects/python/djangotest <Directory /> Options All AllowOverride All Require all granted </Directory> Alias /static/ /home/USERNAME/projects/python/djangotest/static/ <Location "/static/"> Options -Indexes </Location> ErrorLog /home/USERNAME/projects/python/djangotest/apache/logs/error.log CustomLog /home/USERNAME/projects/python/djangotest/apache/logs/access.log combined WSGIScriptAlias / /home/USERNAME/projects/python/djangotest/djangotest/wsgi.py WSGIDaemonProcess djangotest python-path=/home/USERNAME/projects/python/djangotest processes=2 threads=15 display-name=DjangoTest WSGIProcessGroup djangotest </VirtualHost> Lastly enable the site and restart Apache sudo a2ensite 001-djangotest sudo service apache2 restart PLEASE NOTE: On Ubuntu 13.10 due to Apache being now 2.4 there is a fairly important change in access permissions (which cost me some time to…

Continue Reading Ubuntu 13.10 based Python/Django/WSGI setup