Skip to content

Commit

Permalink
fix: web server
Browse files Browse the repository at this point in the history
  • Loading branch information
kdheepak committed Jul 8, 2022
1 parent 116893a commit 844ba99
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions helics/flaskr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

current_directory = os.path.realpath(os.path.dirname(__file__))

app = Flask(__name__.split(".")[0], static_url_path="", static_folder=os.path.join(current_directory, "../../client/build"))
app = Flask(__name__.split(".")[0], static_url_path="", static_folder=os.path.join(current_directory, "../static"))
api = Api(app)
CORS(app, resources={r"/api/*": {"origins": "*"}})

Expand Down Expand Up @@ -241,4 +241,12 @@ def index(path):


def run():
app.run(debug=os.environ.get("PYHELICS_FLASK_DEBUG", False))
debug = bool(os.environ.get("PYHELICS_FLASK_DEBUG", False))
if debug:
host = None
else:
host = "0.0.0.0"
cli = sys.modules["flask.cli"]
cli.show_server_banner = lambda *x: None
os.environ["WERKZEUG_RUN_MAIN"] = "true"
app.run(host=host, debug=debug)

0 comments on commit 844ba99

Please sign in to comment.