Before move to Gunicorn
This commit is contained in:
@@ -11,7 +11,6 @@ from config import CONFIG # Imports the configuration file
|
||||
from manager import * # Imports the Manager file that contains the functions for the API
|
||||
from flask_session import Session # Imports the session module
|
||||
from scheduler import run_schedule # Imports the scheduler module
|
||||
from manager import log_event # Imports the log_event function from the manager module
|
||||
|
||||
#################
|
||||
### Connexion ###
|
||||
@@ -34,21 +33,21 @@ def API():
|
||||
app = create_app()
|
||||
debug_value = CONFIG["server"]["debug"]
|
||||
debug = False if debug_value.lower() == 'false' else True
|
||||
app.run(host=CONFIG["server"]["url"], debug=debug)
|
||||
app.run(host=CONFIG["server"]["host"], port=CONFIG["server"]["port"], debug=debug)
|
||||
|
||||
################
|
||||
### Run Code ###
|
||||
################
|
||||
|
||||
if __name__ == "__main__":
|
||||
log_event("Starting API...") # Create a thread that will run the run_schedule function in the background
|
||||
event_logger("Starting API...") # Create a thread that will run the run_schedule function in the background
|
||||
scheduler = CONFIG["server"]["scheduler"]
|
||||
scheduler = False if scheduler.lower() == 'false' else True
|
||||
if scheduler:
|
||||
thread = threading.Thread(target=run_schedule)
|
||||
thread.daemon = True # Set the thread as a daemon thread
|
||||
thread.start()
|
||||
log_event("Scheduler started.")
|
||||
event_logger("Scheduler started.")
|
||||
API()
|
||||
log_event("API stopped.") # This line will only be reached if the API is stopped
|
||||
event_logger("API stopped.") # This line will only be reached if the API is stopped
|
||||
|
||||
Reference in New Issue
Block a user