[Django]-How to install Mezzanine on Webfaction Server

8👍

To install Mezzanine on a WebFaction hosting account, first create a new PostgreSQL database via the WF control panel, and make a note of the database name and password.

Next, create a “Django 1.6.10 (mod_wsgi 3.5/Python 2.7)” application and assign it to a website.

Next, SSH into your server and run the following commands (replacing name_of_your_app, database_name, database_password, and my_cms with appropriate values):

mkdir -p ~/lib/python2.7
easy_install-2.7 pip
cd ~/webapps/name_of_your_app
export PYTHONPATH=$PWD/lib/python2.7
pip2.7 install -U --install-option="--install-scripts=$PWD/bin" --install-option="--install-lib=$PWD/lib/python2.7" mezzanine
~/bin/mezzanine-project my_cms
cd my_cms
sed -i 's/"ENGINE": "django.db.backends.sqlite3"/"ENGINE": "django.db.backends.postgresql_psycopg2"/g' local_settings.py
sed -i 's/"NAME": "dev.db"/"NAME": "database_name"/g' local_settings.py
sed -i 's/"USER": ""/"USER": "database_name"/g' local_settings.py
sed -i 's/"PASSWORD": ""/"PASSWORD": "database_password"/g' local_settings.py
sed -i 's/DEBUG = True/DEBUG = False/g' local_settings.py
echo "ALLOWED_HOSTS = ['yourdomain.com',]" >> local_settings.py
python2.7 manage.py createdb --noinput
python2.7 manage.py collectstatic --noinput
sed -i 's/myproject\/myproject\/wsgi.py/my_cms\/wsgi.py/g' ../apache2/conf/httpd.conf
sed -i 's/myproject/my_cms/g' ../apache2/conf/httpd.conf
../apache2/bin/restart

Next, create a “Symbolic link to static-only app” in the control panel, using “/home/your_username/webapps/name_of_your_app/my_cms/static” as the symlink path (in the “extra info” field, then assign that app to your site, using ‘/static‘ as the URL path.

Then just wait a few minutes for that last change to gel, and you’re done.

👤Sean F

0👍

Ok, since no one has answered my question yet, and since I realize django-cms is a better alternative for me, I decide to close this question by answering it myself. Thanks.

Leave a comment