refactor: Setup using gunicorn
This commit is contained in:
+2
-1
@@ -1,3 +1,4 @@
|
||||
tailwindcss
|
||||
static/output.css
|
||||
.env
|
||||
.env
|
||||
__pycache__
|
||||
+1
-1
@@ -12,4 +12,4 @@ RUN pip install -r requirements.txt \
|
||||
&& ./tailwindcss -i ./static/input.css -o ./static/output.css --content "./templates/*.html" --minify \
|
||||
&& rm tailwindcss
|
||||
EXPOSE 5000
|
||||
CMD ["python", "app.py"]
|
||||
CMD ["gunicorn", "--workers", "2", "--bind", "0.0.0.0:5000", "app:app", "--log-level", "warning"]
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import pytz
|
||||
import logging
|
||||
from flask import Flask, render_template, request, redirect, url_for, session, jsonify
|
||||
from datetime import datetime, date as datedate, datetime as dt
|
||||
import mysql.connector
|
||||
@@ -22,6 +23,8 @@ mysql_config = {
|
||||
'database': os.getenv('MYSQL_DATABASE', 'echolog')
|
||||
}
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='[%(asctime)s] %(levelname)s in %(module)s: %(message)s')
|
||||
|
||||
def get_db_connection():
|
||||
return mysql.connector.connect(**mysql_config)
|
||||
|
||||
@@ -189,6 +192,4 @@ def delete_entry(entry_id):
|
||||
return redirect(url_for('index'))
|
||||
|
||||
init_db()
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5000)
|
||||
logging.info('EchoLog started up successfully.')
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
Flask
|
||||
mysql-connector-python
|
||||
python-dotenv
|
||||
pytz
|
||||
pytz
|
||||
gunicorn
|
||||
Reference in New Issue
Block a user