pip install -r requirement.txt
# Login
sudo -u postgres psql
# User creation:
CREATE ROLE banglasketch WITH LOGIN PASSWORD '******';
# Database creation:
CREATE DATABASE banglasketch;
# Assign user to Database:
grant all privileges on database banglasketch to banglasketch;
# How to permanently set environmental variables in ubuntu
sudo echo "SEND_ME_DEVELOPMENT_MODE=prod" >> /etc/environment
- in production: SEND_ME_DEVELOPMENT_MODE
- in local PC: SEND_ME_DEVELOPMENT_MODE
- in systemd: SEND_ME_DEVELOPMENT_MODE
/home/samad/websites/django/sendme/prod_server_bin/start-sendme-server.sh
cd /home/samad/websites/django/sendme
source venvSendme/bin/activate
cd sendMe
gunicorn sendMe.wsgi
sendme-gunicorn.service
upstream django {
server 127.0.0.1:8000;
}
server {
listen 8052;
location /static/ {
root /var/www/djago_files/sendme;
try_files $uri =404;
}
location /media/ {
root /var/www/djago_files/sendme;
try_files $uri =404;
}
location / {
try_files $uri @send_to_django;
}
location @send_to_django{
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://django;
}
}
file location: cat /etc/systemd/system/sendme-gunicorn.service
[Unit]
Description=Gunicorn server for sendme website
After=network.target
[Service]
Type=simple
User=samad
ExecStart=/bin/bash /home/samad/websites/django/sendme/prod_server_bin/start-sendme-server.sh
Environment="SEND_ME_DEVELOPMENT_MODE=prod"
Restart=on-failure
[Install]
WantedBy=multi-user.target