https://github.com/mkbeh/multiple-fishing
https://github.com/mkbeh/multiple-fishing
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/mkbeh/multiple-fishing
- Owner: mkbeh
- License: mit
- Created: 2020-06-17T21:00:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-11T20:51:56.000Z (almost 6 years ago)
- Last Synced: 2025-03-24T14:48:25.445Z (over 1 year ago)
- Language: CSS
- Size: 1.83 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# multiple-fishing
### Known Issues
* There is no centering of the authentication form in firefox on the laptop mode
* Nginx 404 not found on www
## Installation
### Build dependencies
```
adduser django
usermod -aG sudo django
su django
cd
sudo apt update
sudo apt install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl \
git libpq-dev supervisor nginx
```
### Python installation
```
# pyenv installation.
curl https://pyenv.run | bash
# Load pyenv automatically by adding
# the following to ~/.bashrc:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
. ~/.bashrc
# Installing Python specific version.
pyenv install --list | grep " 3\.[678]"
pyenv install -v 3.7.7
pyenv versions
pyenv global 3.7.7
# Check current Python version.
pyenv versions
```
### -- preparation
```
python3.7 -m venv venv
source venv/bin/activate
python3.7 -m pip install django
```
### Creating DB for Django application
```
# - Migrations -
python3.7 manage.py makemigrations yandex
python3.7 manage.py migrate
# - Deploying static files -
python3.6 manage.py collectstatic --link
# - Creating superuser -
python3.7 manage.py createsuperuser
```
### NGINX
```
deactivate
sudo systemctl enable nginx
sudo vi /etc/sysctl.conf
# - Add next line in the end of the file -
fs.file-max = 40000
sudo sysctl -p
sudo cp multiple_fishing/server_configs/nginx.conf /etc/nginx/
# - Fill in the nginx.conf -
# - return 301 $sheme://; Change domain on yours in this line -
sudo vi /etc/nginx/nginx.conf
# - Fill in the config file custom_nginx.conf -
vi multiple_fishing/server_configs/custom_nginx.conf
sudo nginx -t
```
### Adding SSL
```
# NOTE: check latest certbot instruction on official site
# https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx ,
# there maybe some changes
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx
sudo certbot --nginx -d certonly
sudo rm /etc/letsencrypt/options-ssl-nginx.conf
crontab -e
# - Add next line for auto updating cert -
@daily certbot renew
# - Uncomment ssl supporting in custom_nginx.conf
```
### UWSGI
```
sudo python3.7 -m pip install uwsgi
# - Fill in the config file custom_uwsgi.ini -
vi /path/to/custom_uwsgi.ini
# - Copy configs to /etc/...
sudo mkdir -p /etc/uwsgi/vassals
sudo cp /path/to/server_configs/emperor.ini /etc/uwsgi/
sudo ln -s /abs/path/to/server_configs/custom_uwsgi.ini /etc/uwsgi/vassals
sudo systemctl restart nginx.service
# - Running the Django application with uwsgi and nginx -
# - Need for debug , another use systemd -
uwsgi --emperor /etc/uwsgi/emperor.ini
# - UWSGI production -
sudo cp /path/to/server_configs/emperor.uwsgi.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start emperor.uwsgi.service
sudo systemctl enable emperor.uwsgi.service
```