Obviously, for any web application there is some infrastructure necessary to serve it:
-
You will need a webserver (I provide information for using Apache 2.2)
-
You will need a database (I will stick with PostgreSQL)
-
For a python based app, you will need, of course, Python (runs on either PYthon2 or Python3)
-
In this how-to we will use pip
-
For installing the PostgreSQL driver we will use in this how-to through pip, we need the python and postgres development libraries. On Debian/Ubuntu:
# apt-get install libpq-dev python-dev
On RHEL/CentOS:
# yum install python-devel postgresql-devel
-
For Apache we need the wsgi module On Debian/Ubuntu:
# apt-get install libapache2-mod-wsgi
On RHEL/CentOS:
# yum install mod_wsgi
-
Download the archive file or checkout from git:
$ git clone http://git.thesecretgamer.de/faldon/yapybs.git /your/production/directory
or
$ git clone https://github.com/Faldon/yapybs.git /your/production/directory
-
It's recommended to setup a virtual environment. Consult the python documentation how to do this.
-
Install the requirements django, django-summernote and psycopg2.
# cd /your/production/directory # pip install -r requirements.txt
-
Create a production settings file by copying the provided example
$ cp /your/production/directory/yapybs/production.py.example /your/production/directory/yapybs/production.py
-
Create secret key and paste it as value for SECRET_KEY in the production setting:
$ python -c /your/production/directory/create_secret.py
-
Adjust all other settings to reflect your environment according to the comments in the production.py file. Mainly, provide a valid database setup
-
For Apache 2.2, copy the provided yapybs.conf.example to the config directory of apache.
-
Debian-based: /etc/apache2/sites-available/
-
RedHat-based: /etc/httpd/conf.d/
Adjust the vhost config to your needs according to the comments in the yapybs.conf.example file.
-
-
Let django migrate the database and copy the static files. Run from your production directory:
$ python manage.py migrate admin --settings=yapybs.production $ python manage.py migrate --settings=yapybs.production $ python manage.py collectstatic --settings=yapybs.production
-
Let django run a final check:
$ python manage.py check --deploy --settings=yapybs.production
Ignore security.W019 for I think we need it for summernote.
-
Finally, it looks that you are ready to go. Restart your webserver.