【发布时间】:2021-03-11 08:59:15
【问题描述】:
我目前正在尝试将我的 python/flask 应用程序部署到 pythonanywhere,但目前卡在 WSGI 配置步骤。这是我的代码:
import sys
#
## The "/home/azanbade" below specifies your home
## directory -- the rest should be the directory you uploaded your Flask
## code to underneath the home directory. So if you just ran
## "git clone git@github.com/myusername/myproject.git"
## ...or uploaded files to the directory "myproject", then you should
## specify "/home/azanbade/myproject"
path = '/home/azanbade/path/to/Word-finder'
if path not in sys.path:
sys.path.append(path)
#
from app import app as application # noqa
#
# NB -- many Flask guides suggest you use a file called run.py; that's
# not necessary on PythonAnywhere. And you should make sure your code
# does *not* invoke the flask development server with app.run(), as it
# will prevent your wsgi file from working.
在我尝试运行应用程序之前,一切看起来都很好。我继续收到此错误消息“ModuleNotFoundError: No module named 'app'”
这是我的根目录和服务器(这是我的应用程序的主文件)的照片: Root Directory, Server
我的配置格式正确吗?
【问题讨论】:
标签: python flask pythonanywhere