我使用dev环境来运行django服务器:
$python manage.py runserver 0.0.0.0:8000
但管理页面中的相关图标无法正确显示:
我认为settings.py
中的参数不正确,任何人都可以帮我设置它吗?
以下是我settings.py
的内容:
import os
_ROOT_PATH = os.path.dirname(__file__)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'zl0djft^%oq8toum-*9o^m#bg38st%q0k8n@1o5_2gz#pk20'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'CI',
'CT',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'ibuildmaster.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(_ROOT_PATH, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'ibuildmaster.wsgi.application'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATICFILES_DIRS = (
os.path.join(_ROOT_PATH, 'static'),
)
STATIC_URL = '/static/'
我的'urls.py'的内容:
urlpatterns = [
url(r'^' , include('CI.urls')),
url(r'^CI/', include('CI.urls')),
url(r'^CT/', include('CT.urls')),
url(r'^admin/', admin.site.urls),
]
答案 0 :(得分:0)
对我来说,静态文件在管理页面中正确提供,请检查浏览器设置或文件/文件夹权限