【发布时间】:2015-10-19 17:35:51
【问题描述】:
我使用 web.py 创建了一个小型 Web 应用程序。通过网络浏览器部署和访问应用程序时,我收到与 javascript 文件位置相关的错误。
我遵循了 learnpythonthehardway.org 中推荐的结构,所以我有以下内容:
myapp/
bin/
app.py
python_module/
my_module.py
static/
javascript/
myScript.js
templates/
index.html
在 index.html 中我有下一行:
<script type="text/javascript" src="/static/javascript/myScript.js"></script>
我已将文件上传到 /var/www/html/myapp
在 apache 中我必须进行以下配置:
WSGIScriptAlias /myapp /var/www/html/myapp/bin/app.py
DocumentRoot /var/www/html
现在,当我访问 http://example.com/myapp 时出现 404 错误,因为应用程序正在 http://example.com/static/javascript/myScript.js 中寻找 javascript
除了更改 index.html 内 script 标签中的 src 属性外,在正确位置查找 javascript 文件的配置是什么?
谢谢。
【问题讨论】:
标签: javascript apache web.py