# GUNICORN Deployment

```bash=
source .venv/bin/activate
python manage.py migrate
python manage.py collectstatic
sudo systemctl restart gunicorn
sudo systemctl reload nginx
```
1. activate python virtual environment for next calls of python
2. change database model if needed by executing migrations
3. copies static files to STATIC_ROOT (defined in settings.py) to which **gunicorn** looks and to which **nginx** has to look at
4. restarts gunicorn to update the server (needed, if code has changed - not if only staticfiles changed)
5. reloads nginx configuration (only needed, if nginx configuration changed)
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9