I am having some issue getting the routes to work for a Flask app, while using Hops. Here is the sample code:
from flask import Flask, request, render_template import ghhops_server as hs #Register hops as middleware app = Flask(__name__) app.debug = True hops: hs.HopsFlask = hs.Hops(app) @app.route("/help") def help(): return "Welcome to Grasshopper Hops for CPython!" if __name__ == "__main__": app.run(debug=True)
When I run this and visit http://localhost:5000/help, it returns with an Error 404, Unknown URI.
If I comment out the line
hops: hs.HopsFlask = hs.Hops(app) it works as expected:
When I try to run a different app (app2), that doesn’t initialize the Hops Component, it can also work fine, but I can’t seem to get two different Flask apps to run concurrently via threading or multiprocessing.
Do you know how I can get the routes to work properly, or alternatively, have any suggestions for running multiple Flask apps at the same time from the same script?