它以前工作正常,我不知道发生了什么变化,但我现在在加载静态文件时遇到错误=(请帮助!
使用 Django 1.4
网址.py
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
设置.py
STATIC_ROOT = '/root/abc/abc_app/sitestatic'
# URL prefix for static files.
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
'/root/abc/static/',
'/Users/blahusername/djangoproj/abc/static/',
)
页眉.html
<script type="text/javascript" src="/static/js/jquery-1.7.1.min.js"></script>
浏览器中的错误:
GET file://localhost/static/js/jquery-1.7.1.min.js
Unsafe JavaScript attempt to access frame with URL file://localhost/Users/blahusername/djangoproj/abc/abc_app/templates/index.html from frame with URL http://www.youtube.com/embed/yyy. Domains, protocols and ports must match.