Firebase Hosting Flask Application

故事扮演 提交于 2019-12-07 14:32:34

问题


I'm attempting to host a simple flask application on a hackathon project, but I'm running into an issue where it can not identify the routes. For example, say my flask route is:

@app.route('/helloWorld', methods=['POST'])
    def index():
        inputted_name = request.form['nm']
        return 'Hello World ' + inputted_name

and my index.html is

<html>
   <body>

      <form action = "{{ url_for('helloWorld') }}" method = "post">
         <p>Enter Name:</p>
         <p><input type = "text" name = "nm" /></p>
         <p><input type = "submit" value = "submit" /></p>
      </form>

   </body>
</html>

and my firebase.json

{
      "hosting": {
          "public": "folder_containing_above"
      }
}

While being hosted on firebase, I can't seem to get the html to talk to the flask route, and return the Hello world string. Instead it says

Page Not Found This file does not exist and there was no index.html found in the current directory or 404.html in the root directory.

Any help is appreciated!

来源:https://stackoverflow.com/questions/47618532/firebase-hosting-flask-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!