我试图通过以下几篇文章来解决这个问题,但是仍然不能解决it.Admin sit缺少它的css、javascripts和图像。我的setting.py文件是
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import os.path
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '-g&@qu=+mm-li1xtsz_9a7c5uz6-&jq3y==7ib1%8zy2f@-_q4'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'book',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'Onlinebook.urls'
WSGI_APPLICATION = 'Onlinebook.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_ROOT = os.path.join(os.path.dirname(__file__), 'static/')
STATIC_URL = '/static/'
# STATICFILES_DIRS = (
# 'K:/Analytics/Java/Onlinebook/src/book',
#
# # Put strings here, like "/home/html/static" or "C:/www/django/static".
# # Always use forward slashes, even on Windows.
# # Don't forget to use absolute paths, not relative paths.
# )
TEMPLATE_DIRS= (
os.path.join (os.path.dirname(__file__),'templates').replace('\\','/')
)显示效果就像
姜戈政府欢迎,瓦伊萨利。更改密码/注销站点管理授权组添加更改用户添加更改手册作者添加更改手册添加更改发布者添加更改
任何帮助都将不胜感激
发布于 2014-08-12 21:09:12
好的,在浪费了3-4天之后,我终于发现我的项目出了什么问题。我在Windows8.1上使用它,因此由于一些未知的问题,它无法支持所有静态文件。我试着在另一个装有Windows7的系统上运行我的项目,它工作得非常好。因此,Windows 8.1用户可以停止在论坛上提供的以下解决方案上浪费时间。
https://stackoverflow.com/questions/25177396
复制相似问题