For the installation of the app, an Ubuntu 18 server is recommended.
- Install Python 3.6 or later
- Install pip (it comes bundled with Python by default)
- Install virtualenv
- Install virtualenvwrapper (recommended)
- Install client and server instances of PostgreSQL version 10 or later You can follow this tutorial.
- Create a database dedicated for the app
- Create a python virtual enviroment for the app
- Create
/config/settings/production.json
and give parameters as described in the following schema
{
"HOST": "xxx.xxx.xxx.xxx",
"DB_USER": "DB_USER",
"DB_PASS": "SUPER_HARD_PASS",
"STATIC_ROOT": "/var/www/static"
}
- Fetch last changes
git pull
- Activate the virtual environment
workon emspgp
- Update python dependencies
pip install -r requirements.txt
- Update the database ./manage.py migrate
- Activate the node environment
nvm use
- Install javascript dependencies
yarn instal
- Bundle front-end files
yarn build
- Bundle all static files and send them to STATIC_ROOT folder
./manage.py collectstatic
-
Execute
gunicorn config.wsgi --bind 127.0.0.1:9010
-
Make sure to set a web server to proxy the gunicorn port
server {
listen 9000;
server_name xxx.xxx.xxx.xxx;
access_log /path_to/emspgp/logs/nginx_access.log;
error_log /path_to/emspgp/logs/nginx_error.log;
location /static {
root /path_to/emspgp/static;
}
location / {
proxy_pass http://127.0.0.1:9010;
}
}
- Continuously build front-end files
yarn start
(keep terminal open) - Run server
./manage.py runserver --settings=config.settings.development