【发布时间】:2016-04-08 00:54:00
【问题描述】:
我知道有很多关于这个话题的话题,但在我的情况下它对我没有帮助。我真的很困惑。我的应用看不到我的静态文件。
我的应用程序的结构:
myapp-
setting-
settings.py
url.py
app
templates
static
Settings.py
PROJECT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
STATIC_URL = '/static/'
STATICFILES_FINDERS = [
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder"
]
urls.py
urlpatterns += patterns('', (
r'^static/(?P<path>.*)$',
'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}
))
模板
{% load staticfiles %}
<link href="{% static 'bower_components/metisMenu/dist/metisMenu.min.css' %}" rel="stylesheet" media="screen">
我做错了什么?谢谢!
【问题讨论】:
标签: python django django-templates django-staticfiles