- If you don't have postgres installed, complete step seven from [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn)(remember to save all the credentials, they will be necessary to run the application).
- If you don't have postgres installed, complete step seven from [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn)(remember to save all the credentials, they will be necessary to run the application).
...
@@ -30,9 +30,9 @@
...
@@ -30,9 +30,9 @@
## Production deployment
## Production deployment
- git pull and other project installation should be performed in a dir where this django app should be installed, in this tutorial it's /var/www/scheduling-system/
- git pull and other project installation should be performed in a dir where this django app should be installed, in this tutorial it's /var/www/scheduling-system/
- install nginx: `apt-get install nginx`
- install nginx: `apt-get install nginx`
- create gunicorn service in systemd (http://docs.gunicorn.org/en/stable/deploy.html#systemd):
- create gunicorn service in systemd (http://docs.gunicorn.org/en/stable/deploy.html#systemd):
### /etc/systemd/system/gunicorn.service
### /etc/systemd/system/gunicorn.service
```
```
[Unit]
[Unit]
...
@@ -67,7 +67,7 @@ ListenStream=[::]:8000
...
@@ -67,7 +67,7 @@ ListenStream=[::]:8000
[Install]
[Install]
WantedBy=sockets.target
WantedBy=sockets.target
- modify nginx configuration
- modify nginx configuration
# /etc/nginx/nginx.conf
# /etc/nginx/nginx.conf
...
@@ -173,4 +173,4 @@ server {
...
@@ -173,4 +173,4 @@ server {
}
}
```
```
- extract static files and make them available via nginx: `./manage.py collectstatic`
- extract static files and make them available via nginx: `./manage.py collectstatic`
- you start application by starting gunicorn and nginx: `service gunicorn start`, `service nginx start`
- you start application by starting gunicorn and nginx: `service gunicorn start`, `service nginx start`