gpt4 book ai didi

python - 返回 header 之前脚本超时 : application. py

转载 作者:行者123 更新时间:2023-12-01 03:31:59 24 4
gpt4 key购买 nike

我一直在尝试使用他们的弹性beanstalk服务在aws上部署我的flask应用程序,但我没有运气。我尝试将应用程序重命名为应用程序或导入为应用程序。我尝试向 httpf.conf 添加不同的内容。但是,没有运气。

有什么想法吗?

这是我正在使用/遇到的一些示例。

[Tue Nov 29 04:36:57.477486 2016] [mpm_prefork:notice] [pid 28202] AH00169: caught SIGTERM, shutting down
[Tue Nov 29 04:36:58.593231 2016] [suexec:notice] [pid 28480] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Nov 29 04:36:58.622166 2016] [so:warn] [pid 28480] AH01574: module wsgi_module is already loaded, skipping
[Tue Nov 29 04:36:58.627404 2016] [auth_digest:notice] [pid 28480] AH01757: generating secret for digest authentication ...
[Tue Nov 29 04:36:58.628967 2016] [lbmethod_heartbeat:notice] [pid 28480] AH02282: No slotmem from mod_heartmonitor
[Tue Nov 29 04:36:58.664458 2016] [mpm_prefork:notice] [pid 28480] AH00163: Apache/2.4.23 (Amazon) mod_wsgi/3.5 Python/3.4.3 configured -- resuming normal operations
[Tue Nov 29 04:36:58.667914 2016] [core:notice] [pid 28480] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Nov 29 04:37:02.142727 2016] [:error] [pid 28485] * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[Tue Nov 29 04:38:05.392413 2016] [core:error] [pid 28509] [client 127.0.0.1:47208] Script timed out before returning headers: application.py
[Tue Nov 29 04:38:09.386271 2016] [core:error] [pid 28508] [client 127.0.0.1:47210] Script timed out before returning headers: application.py
[Tue Nov 29 04:38:13.392044 2016] [core:error] [pid 28506] [client 127.0.0.1:47212] Script timed out before returning headers: application.py
[Tue Nov 29 04:39:04.713037 2016] [core:error] [pid 28532] [client 172.31.63.245:56919] Script timed out before returning headers: application.py

应用程序.py

from project_test import app as application
from project_test.models import db

project_test.__init__.py

from flask import Flask
from datetime import timedelta
from flask_mail import Message, Mail

from flask_login import LoginManager

from project_test.models import db, User

import os

mail = Mail()
app = Flask(__name__)

# app.config.from_object(os.environ['APP_SETTINGS'])

app.config["APP_SETTINGS"] = "project_test.config.DevConfig"
app.config.from_object(app.config["APP_SETTINGS"])

mail.init_app(app)

app.permanent_session_lifetime = timedelta(seconds=900)

login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'login'
login_manager.login_message_category = "danger"

@login_manager.user_loader
def load_user(user_id):
return User.query.filter(User.id == int(user_id)).first()

import project_test.views

谢谢!

最佳答案

这是因为您在代码中的某个位置启动了内置 Flask 开发服务器。从消息中可以明显看出:

Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

通常这是因为 app.run() 正在被调用,但这在您所显示的内容中并不明显。

无论哪种方式,您都不应该启动 Flask 开发服务器,因为 Apache 下的 mod_wsgi 充当 WSGI 服务器。

关于python - 返回 header 之前脚本超时 : application. py,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40858096/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com