Added to requirements and fixed logging

This commit is contained in:
maximstewart 2021-02-05 00:29:23 -06:00
parent d4fbe2d27d
commit 9537943fa5
6 changed files with 26 additions and 13 deletions

View File

@ -1,3 +1,4 @@
eventlet==0.30.1
Flask==1.1.1 Flask==1.1.1
flask-oidc==1.4.0 flask-oidc==1.4.0
Flask-Login==0.5.0 Flask-Login==0.5.0

View File

@ -13,7 +13,7 @@ from flask_login import current_user, login_user, logout_user, LoginManager
# Apoplication imports # Apoplication imports
from core.utils import Logger
# Configs and 'init' # Configs and 'init'
@ -47,6 +47,7 @@ app.config.update({
oidc = OpenIDConnect(app) oidc = OpenIDConnect(app)
login_manager = LoginManager(app) login_manager = LoginManager(app)
bcrypt = Bcrypt(app) bcrypt = Bcrypt(app)
logger = Logger().get_logger()
def oidc_loggedin(): def oidc_loggedin():

View File

@ -6,9 +6,12 @@ import os, logging
class Logger: class Logger:
def __init__(self): def __init__(self):
pass self.logger = self.create_logger("flask_app")
def get_logger(self, loggerName = "NO_LOGGER_NAME_PASSED", createFile = True): def get_logger(self):
return self.logger
def create_logger(self, loggerName = "NO_LOGGER_NAME_PASSED", createFile = True):
""" """
Create a new logging object and return it. Create a new logging object and return it.
:note: :note:

4
src/linux-start.sh Normal file → Executable file
View File

@ -7,7 +7,6 @@
function main() { function main() {
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )" SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
cd "${SCRIPTPATH}"
echo "Working Dir: " $(pwd) echo "Working Dir: " $(pwd)
source "../venv/bin/activate" source "../venv/bin/activate"
@ -20,8 +19,7 @@ function main() {
# Note can replace 127.0.0.1 with 0.0.0.0 to make it 'network/internet' accessable... # Note can replace 127.0.0.1 with 0.0.0.0 to make it 'network/internet' accessable...
# Note: NEED -k eventlet for this to work! I spent too many hours on this... # Note: NEED -k eventlet for this to work! I spent too many hours on this...
# <module>:<app> IE <file>:<flask app variable> # <module>:<app> IE <file>:<flask app variable>
gunicorn wsgi:app -p app.pid \ gunicorn wsgi:app -p app.pid -b $ADDR:$PORT \
-b $ADDR:$PORT \
-k eventlet \ -k eventlet \
-w $WORKER_COUNT \ -w $WORKER_COUNT \
--timeout $TIMEOUT \ --timeout $TIMEOUT \

View File

@ -7,9 +7,18 @@
function main() { function main() {
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )" SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
cd "${SCRIPTPATH}"
echo "Working Dir: " $(pwd) echo "Working Dir: " $(pwd)
source "../venv/bin/activate" source "../venv/bin/activate"
gunicorn --bind unix:/tmp/app.sock wsgi:app -p app.pid
LOG_LEVEL=debug
WORKER_COUNT=1
TIMEOUT=120
# <module>:<app> IE <file>:<flask app variable>
gunicorn wsgi:app -p app.pid -b unix:/tmp/app.sock \
-k eventlet \
-w $WORKER_COUNT \
--timeout $TIMEOUT \
--log-level $LOG_LEVEL
} }
main $@; main $@;

View File

@ -1,3 +1,4 @@
eventlet==0.30.1
Flask==1.1.1 Flask==1.1.1
flask-oidc==1.4.0 flask-oidc==1.4.0
Flask-Login==0.5.0 Flask-Login==0.5.0