Skip to content
Snippets Groups Projects
Commit 4ea529d8 authored by root's avatar root
Browse files

Updated requirements and startup script

parent 56676332
No related branches found
No related tags found
No related merge requests found
__pycache__/
/venv
/logs
cmd.txt
DB_inserts.txt
dumb.sql
scrap_script.py
*.pyc
*.db
......@@ -2,6 +2,7 @@ alembic==0.9.9
click==6.7
dominate==2.3.1
Flask==1.0.2
Flask-Babel
Flask-Bootstrap==3.3.7.1
Flask-Login==0.4.1
Flask-Migrate==2.2.1
......@@ -22,3 +23,5 @@ visitor==0.1.3
Werkzeug==0.14.1
WTForms==2.2.1
WTForms-SQLAlchemy==0.1
pyexcel
gunicorn==19.9.0
run.py 0 → 100644
from app import app
# Setup logging
import logging
from logging.handlers import RotatingFileHandler
from logging import Formatter
format = "[%(asctime)s] p%(process)s\n" \
"[%(levelname)s] in %(name)s: %(filename)s:%(lineno)d\n" \
"%(message)s\n"
logging.basicConfig(
filename=app.config.get('LOG_FILENAME', 'logs/flask.log'),
level=logging.DEBUG,
datefmt="%Y-%m-%d %H:%M:%S",
format = format
)
logging.info(
"\n"
"==============================================================\n"
"Mega-fMRI stimulus Rating Tool Flask application started\n"
"PET-keskus (2018) \n"
)
handler = RotatingFileHandler('logs/flask.log', maxBytes=10000, backupCount=5)
handler.setFormatter(
Formatter(format)
)
app.logger.addHandler(handler)
# Logging for production (nginx + gunicorn)
import os
is_gunicorn = "gunicorn" in os.environ.get("SERVER_SOFTWARE", "")
if is_gunicorn:
app.logger.info("Application run through gunicorn")
gunicorn_logger = logging.getLogger('gunicorn.error')
app.logger.handlers = gunicorn_logger.handlers
app.logger.setLevel(gunicorn_logger.level)
app.logger.info("******************")
'''
else:
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
'''
# EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment