- 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).
-`virtualenv env` to create new virtualenv (contains clean python working environment)
-`. env/bin/activate` (to start using virtualenv)
-`pip install -r requirements.txt` to install project's dependencies
- Create `local_settings.py` file in `(./scheduling-system)/smash/smash` directory by copying the template in `(./scheduling-system)/smash/smash/local_settings.template` and edit your local_setttings.py file to change your database connection data.
- Update migration db scrpit from file structure (`./scheduling-system/smash/manage.py makemigrations`)
- Create the database by applying migrations (`./scheduling-system/smash/manage.py migrate`)
- Create the first, administrative, user- (`./scheduling-system/smash/manage.py createsuperuser`)
## Development
- Remember, that before working you have to activate _virtualenv_, by: `devel@host ~/home/smash/scheduling-system $ . env/bin/activate`
- In order to run development server, run: `devel@host ~/home/smash/scheduling-system/smash $ ./manage.py runserver` and go to `127.0.0.1:8000` in browser
- For reference of HTML tempalte, see [https://almsaeedstudio.com/themes/AdminLTE/pages/widgets.html#](https://almsaeedstudio.com/themes/AdminLTE/pages/widgets.html#)
### Mac Developers
In case of problems with the openssl version installed on the 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`
- create gunicorn service in systemd (http://docs.gunicorn.org/en/stable/deploy.html#systemd):
- setup virtualenv with clean python3 working environment and start using it. Important python3.6 or higher is required
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
[Install]
```bash
WantedBy=multi-user.target
cd scheduling-system
virtualenv env-p python3
.env/bin/activate
```
```
Don't forget to change ownership of `/run/gunicorn/` folder and `/var/log/gunicorn.log` file.
- install smasch dependencies
```
chown -R www-data:www-data /run/gunicorn/
touch /var/log/gunicorn.log
chown www-data:www-data /var/log/gunicorn.log
```
### /etc/systemd/system/gunicorn.socket
```bash
pip install-r requirements.txt
pip install-r requirements-dev.txt
npm install
```
```
[Unit]
Description=gunicorn socket
[Socket]
- Create `local_settings.py` file in `smash/smash` directory by copying the template in `smash/smash/local_settings.template` and edit your local_setttings.py file to change your database connection data.
ListenStream=/run/gunicorn/socket
ListenStream=0.0.0.0:9000
ListenStream=[::]:8000
[Install]
WantedBy=sockets.target
```
- modify nginx configuration
### /etc/nginx/nginx.conf
### Database configuration
There are two databases supported: `sqlite3` or `postgresql`. You can configure database connection in `smash/smash/local_settings.py`.