Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Commands to configure LFS on WebFaction mod_wsgi/Django
cd ~/webapps/app_name/
./apache2/bin/stop
rm -rf lib/python2.7/{D,d}jango* myproject*
PYTHONPATH=$PWD/lib/python2.7 easy_install-2.7 -s $PWD/bin -d $PWD/lib/python2.7 zc.buildout
wget http://pypi.python.org/packages/source/d/django-lfs/django-lfs-installer-0.6.0b5.tar.gz
tar zxf django-lfs-installer-0.6.0b5.tar.gz
cd lfs-installer/
python2.7 bootstrap.py
./bin/buildout -v # this will take a while to run and produce a lot of output, so be patient
sed -i "s/'ENGINE': 'django.db.backends.'/'ENGINE': 'django.db.backends.postgresql_psycopg2'/g" lfs_project/settings.py
sed -i "s/'NAME': ''/'NAME': 'db_name'/g" lfs_project/settings.py
sed -i "s/'USER': ''/'USER': 'db_name'/g" lfs_project/settings.py
sed -i "s/'PASSWORD': ''/'PASSWORD': 'db_password'/g" lfs_project/settings.py
sed -i "s/ADMIN_MEDIA_PREFIX/#ADMIN_MEDIA_PREFIX/g" lfs_project/settings.py
./bin/django syncdb
./bin/django lfs_init
./bin/django collectstatic
cat > ../lfs_project.wsgi <<EOF
import os
import sys
$( grep -B 1 -A 1 lfs-installer bin/django )
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'lfs_project.settings'
application = WSGIHandler()
EOF
sed -i 's/myproject/lfs_project/g' ../apache2/conf/httpd.conf
../apache2/bin/restart
@defulmere

This comment has been minimized.

Copy link
Owner Author

defulmere commented Nov 29, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.