在aws beanstalk中提供内部服务器错误的render_模板

yqkkidmi  于 2021-09-08  发布在  Java
关注(0)|答案(0)|浏览(125)

我正在尝试在aws elasticbeanstalk中托管一个简单的应用程序,但是当我使用render_模板时,它给了我此错误“内部服务器错误服务器遇到内部错误,无法完成您的请求。服务器过载或应用程序中存在错误。“
这是我的密码,

from flask import Flask, render_template
import requests

application = Flask(__name__, template_folder="templates", static_folder="static")

@application.route("/")
def index():
    return render_template('index.html')

# run the app.

if __name__ == "__main__":
    application.debug = True
    application.run()

我的html代码,

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

<div>
    <h1>Hello, Flask!</h1>
</div>

</body>
</html>

我的目录结构,

templates
  |
   ------> index.html
application.py
requirments.txt

但是当我不使用render_模板时,我看不到任何问题,下面是代码,

from flask import Flask, render_template
import requests

application = Flask(__name__, template_folder="templates", static_folder="static")

@application.route("/")
def index():
    return "Hello Flask!!"

# run the app.

if __name__ == "__main__":
    application.debug = True
    application.run()

先谢谢你。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题