返回前脚本超时 headers:application.py

Script timed out before returning headers: application.py

我一直在尝试使用他们的弹性 beantalk 服务在 aws 上部署我的烧瓶应用程序,但我没有任何运气。我尝试将应用程序重命名为应用程序或导入为应用程序。我尝试向 httpf.conf 添加不同的东西。但是,运气不好。

有什么想法吗?

以下是我 using/running 的一些示例。

[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

application.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 开发服务器,因为 mod_wsgi 在 Apache 下充当 WSGI 服务器。