Improve logging

This commit is contained in:
Thomas Sileo 2018-05-23 00:41:37 +02:00
parent 694511121c
commit cc900a2b4c
3 changed files with 12 additions and 1 deletions

View file

@ -3,4 +3,4 @@ ADD . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENV FLASK_APP=app.py
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:5005", "app:app"]
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:5005", "--log-level", "debug", "app:app"]

View file

@ -3,3 +3,8 @@ css:
password:
python -c "import bcrypt; from getpass import getpass; print(bcrypt.hashpw(getpass().encode('utf-8'), bcrypt.gensalt()).decode('utf-8'))"
update:
docker-compose stop
git pull
docker-compose up -d --force-recreate --build

6
app.py
View file

@ -57,6 +57,12 @@ from utils.webfinger import get_actor_url
app = Flask(__name__)
app.secret_key = get_secret_key('flask')
# Hook up Flask logging with gunicorn
gunicorn_logger = logging.getLogger('gunicorn.error')
root_logger = logging.getLogger()
root_logger.handlers = gunicorn_logger.handlers
root_logger.setLevel(gunicorn_logger.level)
JWT_SECRET = get_secret_key('jwt')
JWT = JSONWebSignatureSerializer(JWT_SECRET)