有一个在http://servername.com:5000/上运行的烧瓶应用程序。它封装了gis_webapp/static/...中提供的一些引导和静态文件,这是它应该采用的工作方式。
这是该项目的树:
gis_webapp
├── __init__.py
├── routes.py
├── gunicorn_gis_webapp_conf.py
├── static
│ ├── bootstrap-4.6.0-dist
│ │ ├── css
│ │ └── js
│ ├── css
│ │ └── style.css
│ └── img
│ ├── favicon.png
│ └── glogo.gif
└── templates
├── about.html
├── base.html
├── contact.html
├── errors
│ └── 404.html
├── index.html
└── result.html当我使用必须继承Apache2全部内容的mod_auth_gssapi (通过http://servername.com/ (http://servername.com:80/) )在同一服务器上运行的http://servername.com/gis/应用转发时,就停止工作了:
/static文件夹中的内容gis_webapp/static/bootstrap-4.6.0-dist文件夹引导我做错了什么?
.conf文件的内容如下:
<VirtualHost *:80>
<Location /gis/>
ProxyPass "http://localhost:5000/"
ProxyPassReverse "http://localhost:5000/"
</Location>
</VirtualHost>我在这些线程中找到了一些建议,并试图应用这些建议:
不幸的是他们没能解决我的问题。
我还试图修改我的routes.py文件中的路径。
# main page
@gis_webapp.route("/", methods=["GET"])
@gis_webapp.route("/index", methods=["GET"])
def index():
return render_template("index.html", title="GIS")已改写为:
# main page
@gis_webapp.route("/gis/", methods=["GET"])
@gis_webapp.route("/gis/index", methods=["GET"])
def index():
return render_template("index.html", title="GIS")我还找到了这个线程通过apache提供静态文件,它建议应用ALIAS,但是对我来说不是一个解决方案,因为以后Apache2和Flask将出现在不同的服务器上。然而,有一种观点认为:静力学需要由Apache发布,即使您随后将其分散到不同的服务器上,那么最好将静力学安装到Apache所在的位置。
到目前为止,我可以部分地解决2.和3.问题,并在“base.html”中进行调整,因此本文引用:
<link rel="icon" type="image/png" href="/static/img/favicon.png">改为:
<link rel="icon" type="image/png" href="/gis/static/img/favicon.png">因此,之后我可以在/static页面上看到http://servername.com/gis/文件夹的内容,但是当我通过http://servername.com:5000/打开它时,它就消失了。不明白为什么。有什么想法吗?
https://stackoverflow.com/questions/69101533
复制相似问题