如何使用mod_wsgi和Django提供静态文件?

时间:2012-02-04 23:22:52

标签: python django mod-wsgi

我想使用plist提供静态mod_wsgi文件。已配置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请求进行响应的情况下提供此静态文件?

1 个答案:

答案 0 :(得分:1)

正如@sdolan建议的那样,localhost/site_media/mac_config.plist正在纠正问题。