Django — Can't get static CSS files to load

后端 未结 20 1836
借酒劲吻你
借酒劲吻你 2020-11-29 23:45

I\'m running Django\'s development server (runserver) on my local machine (Mac OS X) and cannot get the CSS files to load.

Here are the relevant entries

20条回答
  •  眼角桃花
    2020-11-30 00:17

    Are these missing from your settings.py? I am pasting one of my project's settings:

    TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.contrib.messages.context_processors.messages")
    

    Also, this is what I have in my urls.py:

    urlpatterns += patterns('', (
            r'^static/(?P.*)$',
            'django.views.static.serve',
            {'document_root': 'static'}
    ))
    

提交回复
热议问题