Tactical Watermarks — Graduation Application
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
root d6e8a838dd url relative 4 years ago
__pycache__ change css 5 years ago
app url relative 4 years ago
.gitignore Update '.gitignore' 4 years ago
README.md changing relative paths 4 years ago
app.log corrent url confi in templates/public/templates and correct config in config.py app/__init__/py 4 years ago
config.py corrent url confi in templates/public/templates and correct config in config.py app/__init__/py 4 years ago
default commiting watermarks.service and nginx/default 4 years ago
file.db url relative 4 years ago
gunicorn_run.sh first commit 5 years ago
requirements.txt first commit 5 years ago
run.py first commit 5 years ago
watermarks.service commiting watermarks.service and nginx/default 4 years ago
wsgi.py first commit 5 years ago

README.md

Run

in Development

export FLASK_APP=run.py export FLASK_ENV=development flask run

Using gunicorn:

gunicorn --env SCRIPT_NAME=/watermark -w 4 -b 127.0.0.1:5000 app:app --log-level debug

  • -w workers
  • -b bind to address / unix socker

And gunicorn with using unix sock: (this how it should run in production) ` gunicorn --env SCRIPT_NAME=/watermark --workers 4 --bind unix:app.sock -m 007 app:app --log-level debug

in Production with gunicorn and unix sockets

Based on https://medium.com/faun/deploy-flask-app-with-nginx-using-gunicorn-7fda4f50066a

systemd service file

Add to /etc/systemd/system/watermarks.service

[Unit]
After=network.target

[Service]
User=psc
Group=www-data
WorkingDirectory=/var/www/TacticalApp
Environment="PATH=/var/www/TacticalApp/venv/bin"
ExecStart=/var/www/TacticalApp/venv/bin/gunicorn --env SCRIPT_NAME=/watermarks --workers 4 --bind unix:app.sock -m 007 app:app

[Install]
WantedBy=multi-user.target

enable & start service file

systemctl enable watermarks.service

systemctl start watermarks.service

It is also a good idea to check the status of the service systemctl status watermarks.service

Nginx config

location / {
    # if using gunicorn with app sock, use:
    proxy_pass http://unix:/var/www/TacticalApp/app.sock;
    # if using gunicord with port 5000, use:
    proxy_pass http://127.0.0.1:5000;
    }

debug.

It might be helpful to enable gunicorn logging, while in development, to check what is going on, by replacing in watermarks.service, the ExecStart= value with:

ExecStart=/var/www/TacticalApp/venv/bin/gunicorn --log-level debug --error-logfile /var/www/TacticalApp/app.log --workers 4 --bind unix:app.sock -m 007 app:app

And reloading the services systemctl daemon-reload

systemctl restart watermarks.service

and the start following app.log: tail -f /var/www/TacticalApp/app.log

But in the long run logging should be disabled


09.06.2020 Handling url path /watermarks

gunicorn -w 4 -b :5000 app:app gunicorn -w 4 -b :5000 app:app