Skip to content

Notes on webfaction install

KimSJ edited this page Feb 27, 2013 · 8 revisions

Create environment

Edit your bash setup to add python alias

nano ~/.bashrc

add a line...

alias python=python2.7

Now write this (ctrl-o [return]), quit (ctrl-X), and reload it:

source ~/.bashrc

Next, make the python2.7 lib folder

mkdir -p ~/lib/python2.7 ~/src

Now get the virtualenv stuff

easy_install-2.7  pip
pip install virtualenv
cd $HOME/src
wget 'http://pypi.python.org/packages/source/v/virtualenvwrapper/virtualenvwrapper-3.6.tar.gz'
tar -xzf virtualenvwrapper-3.6.tar.gz
cd virtualenvwrapper-3.6
PYTHONPATH=$HOME/lib/python2.7 python setup.py install --home=$HOME

Now add more stuff to .bashrc, for virtualenv ...

export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7
source $HOME/bin/virtualenvwrapper.sh

export PIP_VIRTUALENV_BASE=$WORKON_HOME # Tell pip to create its virtualenvs in $WORKON_HOME.
export PIP_RESPECT_VIRTUALENV=true # Tell pip to automatically use the currently active virtualenv.

reload again...

source ~/.bashrc

Create/work with your virtualenv:

mkvirtualenv foo    # Create virtualenv "foo" in $WORKON_HOME
workon foo          # Activate virtualenv "foo"
deactivate          # Deactivate current virtualenv
rmvirtualenv foo    # Remove virtualenv "foo"

Favicon

To make the favicon work, one way is use the following in your django app's apache2/httpd.conf:

LoadModule alias_module modules/mod_alias.so

<Location "/favicon.ico">
    SetHandler None
</Location>

alias /favicon.ico /home/<username>/webapps/path/to/favicon.ico

The same method can also be used to serve a "robots.txt" file. There is a rumour that this works without the <Location ... clause, but I've not tested it (and I'm not convinced).

Managing configurations

A useful primer on production deployment configuration can be found here