【发布时间】:2012-05-25 16:21:19
【问题描述】:
在settings.py中,如果我指定STATIC_URL = 'http://68.164.125.221/',那么客户端可以访问我的网页。但是,不会加载 CSS 和其他静态文件。
另一方面,如果我指定STATIC_URL = '/',则访问我的应用程序的主页会产生此错误。
Page not found (404)
Request Method: GET
Request URL: http://68.164.125.221/
Directory indexes are not allowed here.
You're seeing this error because you have DEBUG = True in your Django settings file.
有趣的是,我的静态文件现在加载(例如 http://68.164.125.221/main.css 加载),尽管我的应用程序的主页显示此错误。
为什么更改我的“STATIC_URL”设置会切换是加载主页还是加载静态文件?我正在使用静态文件应用程序。
【问题讨论】: