我是 Django 新手,正在学习 docs.djangoproject 教程。我的管理页面不显示 css 样式,所以我想我没有正确设置“静态”路径。在家用 PC 上作为 Windows 操作系统的服务器工作。
以下是文件中的一些代码:
设置.py:
DEBUG = True
MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
#Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
网址.py
urlpatterns = patterns('',
# Examples:
#url(r'^$', 'polysite.views.home', name='home'),
#url(r'^polysite/', include('polysite.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
#url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)