Commit c78af632 authored by robert.vincze's avatar robert.vincze

TVB-2593: Added necessary code for running Flask in production mode as...

TVB-2593: Added necessary code for running Flask in production mode as comments to be uncommented after development is finished
parent aaf5ad6f
...@@ -47,6 +47,7 @@ from tvb.interfaces.rest.server.resources.simulator.simulation_resource import F ...@@ -47,6 +47,7 @@ from tvb.interfaces.rest.server.resources.simulator.simulation_resource import F
from tvb.interfaces.rest.server.resources.user.user_resource import GetUsersResource, GetProjectsListResource from tvb.interfaces.rest.server.resources.user.user_resource import GetUsersResource, GetProjectsListResource
from tvb.interfaces.rest.server.rest_api import RestApi from tvb.interfaces.rest.server.rest_api import RestApi
from dotenv import load_dotenv from dotenv import load_dotenv
# from gevent.pywsgi import WSGIServer
TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE) TvbProfile.set_profile(TvbProfile.COMMAND_PROFILE)
...@@ -56,7 +57,8 @@ LOGGER.info("TVB application will be running using encoding: " + sys.getdefaulte ...@@ -56,7 +57,8 @@ LOGGER.info("TVB application will be running using encoding: " + sys.getdefaulte
FLASK_PORT = 9090 FLASK_PORT = 9090
dotenv_path = os.path.join(os.path.dirname(__file__), '.env') # Path to .env file # Comment these lines when running in production mode
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
load_dotenv(dotenv_path) load_dotenv(dotenv_path)
...@@ -134,6 +136,9 @@ def initialize_flask(): ...@@ -134,6 +136,9 @@ def initialize_flask():
api.add_namespace(name_space_operations) api.add_namespace(name_space_operations)
api.add_namespace(name_space_simulation) api.add_namespace(name_space_simulation)
# Uncomment these lines and comment app.run... for running Flask in production mode
# http_server = WSGIServer(("0.0.0.0", FLASK_PORT), app)
# http_server.serve_forever()
app.run(host="0.0.0.0", debug=True, port=FLASK_PORT) app.run(host="0.0.0.0", debug=True, port=FLASK_PORT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment