MaturePyRobot 2017 Build Status License: GPL v3 PyPI - Python Version PostgreSQL PyPI - Django Version

Pre-requirements

Development

Install PostgreSQL

Recommend install PostgreSQL via docker: https://hub.docker.com/_/postgres/

$ docker pull postgres
$ docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=yourpassword  --name postgres postgres

Install dependencies and initiate data

Automate:

$./init.sh

OR manually:

$ pip3 install -r requirements.txt
$ python3 manage.py makemigrations
$ python3 manage.py migrate
$ python3 manage.py loaddata backend/fixtures/database.json

Configure database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'database_name',
        'USER': 'username',
        'PASSWORD': 'yourpostgrepassword',
        'HOST': 'db host',
        'PORT': 'db port',
    }
}

Run

$ ./run.sh

OR

$ python3 manage.py runserver

The server will be available at http://127.0.0.1:8000/

Deployment Nginx Supervisor Redis

Pre-requirements

Deploy

Install Python3 and PostgreSQL on your server, don’t forget to install Python development library (python-dev or python-devel) if you don’t build Python from source

Install lastest Nginx: https://www.nginx.com/resources/admin-guide/installing-nginx-open-source/. Check Installing From NGINX Repository section.

Install Supervisor:

$ sudo apt-get install supervisor

Install redis

$ sudo apt-get install redis-server

Push your code to the server

Edit WebPyRobot/production.py to add your database, secret key, Channels settings for production

Install dependencies and initiate data:

$ ./init.sh

Setup static files for Nginx

$ python3 prod_manage.py collectstatic

Edit configuration files in conf/ to match your server settings:

Start supervisord and nginx

$ sudo systemctl service start supervisord
$ sudo systemctl service start nginx

Enjoy your production!