Installing Asylguiden on centos Server

One of my own prodjects are Asylguiden. Its A python publish system build with django, Mysql and mongodb.
You can find the code here on github

https://github.com/mattiashem/asylguiden

Asylguiden also works with wsgi for python and apache for displaying content

here is my own how to for downloadning and setting up asylguiden on a production server.

1. Setting up server for hosing

Centos

yum install httpd mod_ssl git wget python-setuptools mod_wsgi

 

Django https://www.djangoproject.com/download/

wget https://www.djangoproject.com/download/1.6.2/tarball/
tar zxvf index.html
cd Django-1.6.2/
sudo python setup.py install

MariaDB https://mariadb.org/

vi /etc/yum.repos.d/maria.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos5-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
yum install MariaDB-Galera-server MariaDB-client galera

Mongodb http://www.mongodb.org/

vi /etc/yum.repos.d/mongodb.repo
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

Mongoegine http://mongoengine.org/

 

easy_install -U mongoengine

 

2. Getting CODE

cd /var/www

git clone https://github.com/mattiashem/asylguiden.git
git branch dev
git checkout dev
git pull origin dev

As you see here om using dev branch

vi .gitignore
asylguiden/settings.py
*.pyc
git rm --cached asylguiden/settings.py
git rm --cached *.pyc

In asylguiden/settings.py change the following

MEDIA_ROOT = '/var/www/asylguiden/media'
MEDIA_URL = 'http://www.asylguiden.se/media/'
STATIC_ROOT = '/var/www/asylguiden/static'
STATIC_URL = 'http://www.asylguiden.se/static/'
SECRET_KEY = 'XXXXXXXXXXXXXXXXXXXXXXX' <--- change

In template_dir

'/var/www/asylguiden/template'

Setup apache and wsgi_mod

Setup apache config

<VirtualHost *:80>
 ServerName www.asylguiden.se
 DocumentRoot /var/www/asylguiden
 Alias /robots.txt /var/www/asylguiden/static/robots.txt
 Alias /favicon.ico /var/www/asylguiden/static/favicon.ico
 AliasMatch ^/([^/]*\.css) /var/www/asylguiden/static/css/styles/$1
 Alias /media/ /var/www/asylguiden/static/
 <Directory /var/www/asylguiden/static/>
 Order deny,allow
 Allow from all
 </Directory>
 WSGIScriptAlias / /var/www/asylguiden/asylguiden/wsgi.py
 <Directory /var/www/asylguiden/asylguiden/wsgi.py>
 Order allow,deny
 Allow from all
 </Directory>
</VirtualHost>

Do some fix in wsgi.py ADD the follwing and leave the rest

 vi /var/www/asylguiden/asylguiden/wsgi.py
import os, sys
sys.path.append('/var/www/asylguiden')

Bring it all upp

/etc/init.d/httpd restart
/etc/init.d/mongo restart

And disable selinux <– Fix will come

setenforce 0