我有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
所以,仅通过flask本地服务器,我曾经运行以下命令
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.
请确保您已定义路由,并且从挖掘导入应用程序时运行了用于定义路由的代码。