Ubuntu 11 12 Production Deployment - abztrakt/labgeeks-buildout GitHub Wiki

These are some notes on how we got things running under Ubuntu 11 & 12. We'd like to get buildout to take care of more of the steps that need to be done by hand eventually.

mkdir /var/django and cd in (don't put project in /var/www because of potential conflicts with other apache things)

change permissions on django folder: make group www-data, chmod g+w, add yourself to www-data (gpasswd)

make baseline virtualenv alongside project (was not used, delete step?)

git clone git://github.com/abztrakt/labgeeks-buildout.git`

apt-get install mysql-server libmysqlclient-dev git-core build-essential python-setuptools python-dev libapache2-mod-wsgi`

easy_install virtualenv

make project a virtual env (virtualenv labgeeks-buildout)

cd labgeeks-buildout, source bin/activate, python bootstrap.py

buildout

cp sample_local_settings.py local_setting.py
edit local_settings.py

changes in local_settings.py:

PATH_TO_APP = /var/django/labgeeks-buildout/labgeeks/

ADMINS : add yourself and anyone relevant in this section in the format specified

DATABASES : edit as appropriate (use mysql!), remember the name, user and password

MEDIA_ROOT = /var/www/uploads/

STATIC_ROOT = /var/www/static/

STATICFILES_DIRS : change uploads to /var/www/uploads

change database

enter mysql prompt, create database corresponding to name entered in local_settings.py

if moving an old labgeeksrpg site to the new labgeeks structure, see migrating from old labgeeks for the steps you need to perform before moving on.

register the db user you specified in local_settings.py with the database. Enter the mysql prompt and execute this query:

GRANT ALL PRIVILEGES ON (insert name).* TO '(insert user)'@'localhost' IDENTIFIED BY '(insert password)' WITH GRANT OPTION;

syncdb, migrate, test (in the new labgeeks, the binary labgeeks performs the same function as python manage.py)

in /etc/apache2/sites-available/default, add:


ServerName your.server's.name
Alias /robots.txt /var/www/robots.txt

<Directory /var/django/labgeeks-buildout>
</Directory>

Alias /static /var/www/static
<Directory /var/www/static>
</Directory>

Alias /uploads /var/www/upload
<Directory /var/www/static>
</Directory>

WSGIScriptAlias / /var/django/labgeeks-buildout/bin/labgeeks.wsgi

In each directory directive, add

Order allow,deny
Allow from all

give www-data group write privileges over /var/www (chmod g+w www/)

create uploads and static dirs in /var/www/, make sure they are group www-data (see migrating from old labgeeks for details on moving uploads to the new server)

labgeeks collectstatic

⚠️ **GitHub.com Fallback** ⚠️