【发布时间】:2020-01-04 04:34:05
【问题描述】:
我有 Flask 应用程序,我想在 pythonanywhere.com 中运行。我关注了Link1、Link2 的链接,但无法解决问题。我的烧瓶应用程序名称是tourismmining,目录的内容列在
应用结构
我的应用程序的结构如下。
tourismmining
|-> instance
|-> mining
|-> resources
|-> entry.py
|-> installation.txt
|-> License
|-> Procfile
|-> README.rst
|-> requirements.txt
核心应用在mining目录下,结构如下
mining
|-> config
|-> db
|-> exceptions
|-> files
|-> forms
|-> logs
|-> models
|-> sink
|-> static
|-> templates
|-> __init__.py
|-> main.py
|-> utils.py
所以,只是通过烧瓶本地服务器,我曾经运行以下命令
cd tourismmining
python -m mining.main
下面是输出
在旅游采矿中,我编写了另一个名为 entry.py 的文件,它包含
from mining import app
if __name__ == '__main__':
app.run(debug=True)
然后我使用以下命令运行文件entry.py
cd tourismmining
python entry.py
现在,将相同的代码上传到pythonanywhere后,目录结构如下所示
设置虚拟环境并尝试了两种配置wsgi文件的方法,如下所示
import sys
path = '/home/s1782662edin/tourismmining'
if path not in sys.path:
sys.path.insert(0, path)
from mining import app as application
import sys
path = '/home/s1782662edin/tourismmining'
if path not in sys.path:
sys.path.insert(0, path)
from entry import app as application
然后重新加载网站,没有任何结果。它说
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your
spelling and try again.
【问题讨论】:
标签: python flask pythonanywhere