Löst problem med cirkulär import. Tagit bort utkommenterad kod.
This commit is contained in:
+13
-16
@@ -6,16 +6,13 @@ from flask_cors import CORS, cross_origin # CORS stands for Cross-Origin Resourc
|
|||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import utils
|
from utils import set_local_logger
|
||||||
from utils import set_local_logger, run_flask
|
|
||||||
|
|
||||||
global log_level # Global variable to store the log level that is set in startservices.py
|
|
||||||
logger = logging.getLogger(__name__) # Separate logger for this module
|
logger = logging.getLogger(__name__) # Separate logger for this module
|
||||||
set_local_logger(logger) # Set log level for logger based on log_level
|
set_local_logger(logger) # Set log level for logger
|
||||||
|
|
||||||
# Initialize a Flask application
|
# Initialize a Flask application
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
# CORS(app, resources={r"/api/chat": {"origins": "*", "headers": ["Origin", "Content-Type", "Authorization"]}}) # Allow requests from any origin
|
|
||||||
CORS(app, resources={
|
CORS(app, resources={
|
||||||
r"/api/chat": {
|
r"/api/chat": {
|
||||||
"origins": "*",
|
"origins": "*",
|
||||||
@@ -89,20 +86,20 @@ def get_response(user_query):
|
|||||||
# Return the generated response
|
# Return the generated response
|
||||||
return response
|
return response
|
||||||
|
|
||||||
# def run_flask(fport=5005):
|
def run_flask(fport=5005):
|
||||||
# """
|
"""
|
||||||
# Starts the Flask server
|
Starts the Flask server
|
||||||
# """
|
"""
|
||||||
# # Flask endpoint for user interaction
|
# Flask endpoint for user interaction
|
||||||
# logger.debug("Entering run_flask()")
|
logger.debug("Entering run_flask()")
|
||||||
# # app.run(port = str(str(fport)), debug=False)
|
# app.run(port = str(str(fport)), debug=False)
|
||||||
# app.run(port = str(str(fport)), debug=True)
|
app.run(port = str(str(fport)), debug=True)
|
||||||
# # app.run(port=5000, debug=True, use_reloader=False)
|
# app.run(port=5000, debug=True, use_reloader=False)
|
||||||
# logger.debug("Exiting run_flask()")
|
logger.debug("Exiting run_flask()")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Run the Flask application
|
# Run the Flask application
|
||||||
run_flask(app)
|
run_flask()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user