settings.py上書きする方法ジャンゴ-CMSテンプレート
from .ENV import BASE_DIR, ENV_VAR
# SECURITY WARNING: don't run with debug turned on in production!
# False if not in os.environ
DEBUG = ENV_VAR('DEBUG', default=False)
# SECURITY WARNING: keep the secret key used in production secret!
# If not found in os.environ will raise ImproperlyConfigured error
SECRET_KEY = ENV_VAR('SECRET_KEY')
SITE_ID = 1
# Application definition
INSTALLED_APPS = [
'djangocms_admin_style',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.messages',
'cms',
'menus',
'sekizai',
'treebeard',
'djangocms_text_ckeditor',
'djangocms_style',
'djangocms_column',
'djangocms_file',
'djangocms_googlemap',
'djangocms_inherit',
'djangocms_link',
'djangocms_picture',
'djangocms_teaser',
'djangocms_video',
'reversion',
'config',
]
MIDDLEWARE_CLASSES = [
'cms.middleware.utils.ApphookReloadMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware'
]
ROOT_URLCONF = 'urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
BASE_DIR('config/templates'),
],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.i18n',
'django.core.context_processors.debug',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.csrf',
'django.core.context_processors.tz',
'sekizai.context_processors.sekizai',
'django.core.context_processors.static',
'cms.context_processors.cms_settings'
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader'
],
},
},
]
WSGI_APPLICATION = 'config.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': ENV_VAR.db()
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en'
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_ROOT = BASE_DIR('media', default='')
MEDIA_URL = '/media/'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR('static')
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
urls.py
from __future__ import absolute_import, print_function, unicode_literals
from cms.sitemaps import CMSSitemap
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap',
{'sitemaps': {'cmspages': CMSSitemap}}),
url(r'^select2/', include('django_select2.urls')),
]
urlpatterns += i18n_patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
)
DIR構造
.
|-- apps
| |-- __init__.py
|-- config
| |-- __init__.py
| |-- settings
| | |-- base.py
| | |-- configurations
| | | |-- DJANGOCMS.py
| | | |-- DJANGO.py
| | | |-- ENV.py
| | | |-- GRAPPELLI.py
| | | |-- __init__.py
| | |-- dev.py
| | |-- __init__.py
| | `-- pro.py
| |-- templates
| | |-- base.html
| | |-- feature.html
| | |-- menu.html
| | |-- page.html
| |-- wsgi.py
|-- manage.py
|-- media
|-- requirements
| |-- base.txt
| |-- dev.txt
| `-- pro.txt
|-- requirements.txt
|-- static
|-- urls.py
私がすることができませんopen localhost:8000 /それは私をログインページにリダイレクトします。それから私は、新しいプロジェクトを作成しており、今回はデフォルトのプロジェクトのレイアウトを維持し、今これは私がlocalhostを開いた場合、私が見たものである:8000/
誰かが私に言うことができるのであれば、何が間違っていますか? ?カスタムテンプレートを使用するにはどうすればいいですか?