[英]How to serve static files with mod_wsgi and Django?
我想使用mod_wsgi
提供静态plist
文件。 在配置了apache
如下
Alias /site_media/ "/var/www/mysite/media/"
<Directory "/var/www/mysite/media">
Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>
当我转到http://localhost/mysite/site_media/mac_config.plist
,出现错误
Page not found (404)
Request Method: GET
Request URL: http://localhost/mysite/site_media/mac_config.plist
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^config/
^admin/doc/
^admin/
The current URL, site_media/mac_config.plist, didn't match any of these.
这个错误告诉我Django
正在拦截请求。 如何在不使用python从磁盘读取文件并使用http请求响应的情况下提供此静态文件?
就像@sdolan
建议的那样,执行localhost/site_media/mac_config.plist
纠正此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.