Tog bort import från backend.py för att undvika cirkulär import

This commit is contained in:
Joakim Persson
2024-07-23 14:22:30 +02:00
parent b3136a9bcd
commit a5d54c2cb6
+2 -15
View File
@@ -2,11 +2,9 @@
# imported to more than one other module. The rational for defining these things here # imported to more than one other module. The rational for defining these things here
# is that it is easier to avoid circular imports when they are defined in a central location. # is that it is easier to avoid circular imports when they are defined in a central location.
import logging import logging
global log_level # Remember, in Python globals are only global in the module it is defined in
log_level = 'INFO' # Default logging level
global log_level
log_level = 'INFO'
logger = logging.getLogger(__name__)
def set_local_logger(log_instance): def set_local_logger(log_instance):
""" """
@@ -22,14 +20,3 @@ def set_local_logger(log_instance):
logging.basicConfig(level=numeric_log_level) # Set the root logger level to the configured level logging.basicConfig(level=numeric_log_level) # Set the root logger level to the configured level
log_instance.info('Log level set to {}'.format(log_level)) # Example usage of the logger log_instance.info('Log level set to {}'.format(log_level)) # Example usage of the logger
def run_flask(app, fport=5005):
"""
Starts the Flask server
"""
# Flask endpoint for user interaction
logger.debug("Entering run_flask()")
# app.run(port = str(str(fport)), debug=False)
app.run(port = str(str(fport)), debug=True)
# app.run(port=5000, debug=True, use_reloader=False)
logger.debug("Exiting run_flask()")