$ python3 -m venv webfortoenv
$ source webfortoenv/bin/activate
$ pip install -r requirements.txt
sudo nano webforto/settings.py
import os
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
python manage.py collectstatic
gunicorn --bind 0.0.0.0:8000 webforto.wsgi
sudo nano /etc/systemd/system/gunicorn.socket
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=regiapriandi
Group=www-data
WorkingDirectory=/home/regiapriandi/PythonProjects/Bismillahirrahmanirrahim/BismillahProject/web-porto/webforto
ExecStart=/home/regiapriandi/PythonProjects/Bismillahirrahmanirrahim/BismillahProject/web-porto/webforto/webfortoenv/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
webforto.wsgi:application
[Install]
WantedBy=multi-user.target
sudo systemctl start gunicorn.socket
sudo systemctl enable gunicorn.socket
curl --unix-socket /run/gunicorn.sock localhost
sudo nano /etc/nginx/sites-available/webforto
server {
listen 80;
server_name 172.18.37.21;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/regiapriandi/PythonProjects/Bismillahirrahmanirrahim/BismillahProject/web-porto/webforto;
}
location /media/ {
root /home/regiapriandi/PythonProjects/Bismillahirrahmanirrahim/BismillahProject/web-porto/webforto;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
sudo ln -s /etc/nginx/sites-available/webforto /etc/nginx/sites-enabled
sudo nginx -t
$ docker-compose up --build -d
[+] Running 3/0
⠿ Container webforto-db-1 Running 0.0s
⠿ Container webforto-web-1 Running 0.0s
⠿ Container webforto-nginx-1 Running 0.0s