2020-02-02 18:22:28 +01:00
|
|
|
#!/bin/bash
|
2020-02-09 14:18:39 +01:00
|
|
|
# This will launch the Django project as a fastcgi socket
|
|
|
|
# then Apache or NGINX will be able to use that socket
|
|
|
|
|
2020-02-11 21:39:08 +01:00
|
|
|
# Option "-i" will be only available in Django 3.0+, but it does not support Python 3.5
|
|
|
|
#python manage.py compilemessages -i ".tox" -i "venv"
|
|
|
|
python manage.py compilemessages
|
2020-02-09 14:18:39 +01:00
|
|
|
|
2020-09-23 17:37:55 +02:00
|
|
|
# Wait for database (docker)
|
2020-02-02 23:13:39 +01:00
|
|
|
sleep 2
|
2020-02-09 14:18:39 +01:00
|
|
|
|
2020-02-02 18:22:28 +01:00
|
|
|
python manage.py migrate
|
2020-02-09 15:29:05 +01:00
|
|
|
python manage.py collectstatic --no-input
|
2020-02-02 18:22:28 +01:00
|
|
|
|
2020-02-09 15:26:34 +01:00
|
|
|
# harakiri parameter respawns processes taking more than 20 seconds
|
|
|
|
# max-requests parameter respawns processes after serving 5000 requests
|
|
|
|
# vacuum parameter cleans up when stopped
|
2020-09-23 17:37:55 +02:00
|
|
|
uwsgi --socket "$(pwd)/uwsgi.sock" --chmod-socket=600 --master --plugins python3 \
|
|
|
|
--module med.wsgi:application --env DJANGO_SETTINGS_MODULE=med.settings \
|
|
|
|
--processes 4 --harakiri=20 --max-requests=5000 --vacuum \
|
2020-09-23 18:50:50 +02:00
|
|
|
--static-map /static="$(pwd)/static" --protocol=fastcgi
|