Backend for personal website(drewdru.com) and fun
Frontend repository: https://github.com/drewdru/sitedrewdru
- Python >= 3.8.0
- requiremets.txt
- PostgreSql
- Redis
- Nginx
Create and configure .env file:
cp .env.example .env && cp .env.example .env.test && cp .env.example .env.ci
# if you use Docker: && cp .env.example .env.dockerTo get a string for SECRET_KEY run:
openssl rand -hex 32virtualenv env -p python3
source env/bin/activate
pip install -r requirements.txtpython manage.py migrations upgrade headpython manage.py run [--prod]python manage.py testpython manage.py createapp microservice_namepython manage.py migrations -h [--prod]
# Autogenerate migrations
python manage.py migrations revision --autogenerate -m "Autogenerate migrations" [--prod]cp .env.example .env.prod && cp .env.example .env.testvirtualenv env -p python3
source env/bin/activate
pip install -r requirements.txtpython manage.py migrations upgrade headConfigure paths in etc/fastDrewDru.service
sudo cp etc/fastDrewDru.service /etc/systemd/system/fastDrewDru.service
sudo systemctl daemon-reload
sudo systemctl start fastDrewDru.service
sudo systemctl enable fastDrewDru.service
sudo service fastDrewDru status # use restart on deployConfigure paths in etc/nginx/sites-available/fastDrewDru.conf
sudo cp etc/nginx/sites-available/fastDrewDru.conf /etc/nginx/sites-available/fastDrewDru.conf
sudo ln -s /etc/nginx/sites-available/fastDrewDru.conf /etc/nginx/sites-enabled/fastDrewDru.conf
sudo service nginx reload