繁体   English   中英

未找到请求的 url。 pythonanywhere中的404错误

[英]The Requested url not found. 404 error in pythonanywhere

我有 Flask 应用程序,我想在 pythonanywhere.com 中运行。 我已经按照链接Link1Link2 ,无法解决问题。 我的烧瓶应用程序名称是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.

确保您已定义路由,并且在从挖矿导入应用程序时运行用于定义路由的代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM