似乎已经多次询问过这个问题,但到目前为止所提供的解决方案都不是我需要的。
我有一个烧瓶应用程序。树如下所示
推送到heroku master后,尝试访问该页面会出现以下错误(较短版本) 2016-07-13T05:48:07.793783 + 00:00 app [web.1]:来自app.Views import home
2016-07-13T05:48:07.793783+00:00 app[web.1]: File "/app/app/Views/home.py", line 3, in <module>
2016-07-13T05:48:07.793785+00:00 app[web.1]: File "/app/app/Helpers/APIHelper.py", line 1, in <module>
2016-07-13T05:48:07.793784+00:00 app[web.1]: from app.Helpers.APIHelper import *
2016-07-13T05:48:07.793785+00:00 app[web.1]: from app.Models.flight import *
2016-07-13T05:48:07.848938+00:00 app[web.1]: [2016-07-13 05:48:07 +0000] [3] [INFO] Shutting down: Master
2016-07-13T05:48:07.793789+00:00 app[web.1]: ImportError: No module named 'app.Models.flight'
Procfile:
web: gunicorn app:app
如果我在本地运行gunicorn app:app
,它将使用localhost成功启动应用程序。
如果我部署到heroku,则无法启动应用程序。
我很感激任何意见。 编辑: 的初始化的.py:
#!/usr/bin/env python
import sys
import os
from flask import Flask
sys.path.append('/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages')
# from flask.ext.login import LoginManager
###############################################################################
# Configuration
###############################################################################
# Flask application setting
app = Flask(__name__)
app.config.from_object(__name__)
app.config.update(dict(
DEBUG = True,
SECRET_KEY = '#####',
USERNAME = '######',
PASSWORD = '######'
))
app.config.from_envvar('APP_SETTING', silent=True)
app.config['basedir'] = os.path.abspath(os.path.dirname(__file__))
# Manager authentication with LoginManager
# Handle Login with LoginManager
# manager = LoginManager()
# manager.init_app(app)
# manager.login_view = 'login'
# This import here has to be at the bottom of this file
# To avoid circular references
from app.Views import views