方法不允许,应用程序在heroku日志中运行没有错误

时间:2019-07-15 08:30:44

标签: python-3.x heroku flask

我已经将我的flask应用程序部署在heroku上,并且在浏览器中的URL上显示“不允许使用方法”。

我所有的路线都设置了方法。除了访问我的页面(没有表单或类似的东西)之外,我没有做其他事情。我用的是金枪鱼。只是不知道我要去哪里错了。

这是我的主文件:

from mongo import get_spotify_music
import os

app = Flask(__name__)


music = list(get_spotify_music())


@app.route("/", methods=['GET'])
@app.route("/index", methods=['GET'])
def home():
    return render_template('index.html', title='about')

is_live = os.environ.get("IS_LIVE", None)
url = '0.0.0.0' if is_live else '127.0.0.1'

if __name__ == "__main__":
    port = int(os.environ.get("PORT", 5000))
    app.run(host=url, port=port, debug=True)```



my Procfile looks like:

```web: gunicorn app:app```

heroku logs --tail looks like:
```2019-07-15T08:25:41.093957+00:00 app[api]: Deploy 325e5224 by user myemail@myemail.com
2019-07-15T08:25:45.035819+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2019-07-15T08:25:47.166897+00:00 app[web.1]: [2019-07-15 08:25:47 +0000] [4] [INFO] Starting gunicorn 19.9.0
2019-07-15T08:25:47.167484+00:00 app[web.1]: [2019-07-15 08:25:47 +0000] [4] [INFO] Listening at: http://0.0.0.0:57502 (4)
2019-07-15T08:25:47.167616+00:00 app[web.1]: [2019-07-15 08:25:47 +0000] [4] [INFO] Using worker: sync
2019-07-15T08:25:47.172768+00:00 app[web.1]: [2019-07-15 08:25:47 +0000] [10] [INFO] Booting worker with pid: 10
2019-07-15T08:25:47.261871+00:00 app[web.1]: [2019-07-15 08:25:47 +0000] [11] [INFO] Booting worker with pid: 11
2019-07-15T08:25:47.852647+00:00 heroku[web.1]: State changed from starting to up
2019-07-15T08:25:50.000000+00:00 app[api]: Build succeeded

当我转到设置的链接时,我只是得到了一种不允许的方法,而不是我的网页。

不知道我在哪里错了...

0 个答案:

没有答案
相关问题