sudo apt-get update
sudo apt install -y python3-venv
python3 -m venv django_env
source django_env/bin/activate
pip install django
pytz-2021.3-py2.py3-none-any.whl
sqlparse-0.4.2-py3-none-any.whl
asgiref-3.4.1-py3-none-any.whl
Django-3.2.8-py3-none-any.whl
pip install gunicorn
-> gunicorn 20.1.0 none-any.whl
pip freeze > requirements.txt
pip install -r requirements.txt
git clone git레포
manage.py있는 level에서 gunicorn --bind 0.0.0.0:8000 mysite.wsgi:application
cd /etc/systemd/system
sudo vi gunicorn.service
~~~~[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/django-boilerplate/mysite
ExecStart=/home/ubuntu/django_env/bin/gunicorn \
--workers 3 \
--bind 0.0.0.0:8000 \
mysite.wsgi:application
[Install]
WantedBy=multi-user.target~~~~
sudo systemctl daemon-reload
sudo systemctl start gunicorn
sudo systemctl status gunicorn
(django 코드 변경 시)
sudo systemctl restart gunicorn
gunicorn 통해 multiprocessing & multithread 가능
에러 로그는
/var/log/syslog
Reference
https://ossian.tistory.com/110
/home/ubuntu/django-boilerplate/mysite