出力される 警告
django-request の
コマンド
python manage.py makemigrations request
OUTPUT
mezzanine.core.W01
というのは、 mezzanineの warningと いう ことかもしれません。
WARNINGS: ?: (mezzanine.core.W01) Please update your settings to use the TEMPLATES setting rather than the deprecated individual TEMPLATE_ settings. The latter are unsupported and correct behaviour is not guaranteed. Here's a suggestion based on on your existing configuration:
- 追記 そもそも、
警告が たくさん 出力されるのは、
Mezzanine4上で、Mezzanine3系の settings.py等を 使用しているからっぽいので、
後日こちらでまとめて対処しました。
対応方法
~~Django 1.8から、
settings.pyの
と
- 追記
TEMPLATE_xxx で記載していた 設定の 移行方法は 以下の サイトに わかりやすく 書かれています。
Migration to 1.8 — Python Anti-Patterns documentation
TEMPLATES = [{u'APP_DIRS': True, u'BACKEND': u'django.template.backends.django.DjangoTemplates', u'DIRS': (u'YOUR_TEMPLATE_DIR',), u'OPTIONS': {u'builtins': [u'mezzanine.template.loader_tags'], u'context_processors': (u'django.contrib.auth.context_processors.auth', u'django.contrib.messages.context_processors.messages', u'django.core.context_processors.debug', u'django.core.context_processors.i18n', u'django.core.context_processors.static', u'django.core.context_processors.media', u'django.core.context_processors.request', u'django.core.context_processors.tz', u'mezzanine.conf.context_processors.settings', u'mezzanine.pages.context_processors.page')}}]
- settings.pyに
上記記述を 追加 # List of callables that know how to import templates from various sources. #TEMPLATE_LOADERS = ( # "django.template.loaders.filesystem.Loader", # "django.template.loaders.app_directories.Loader", #) TEMPLATES = [{u'APP_DIRS': True, u'BACKEND': u'django.template.backends.django.DjangoTemplates', u'DIRS': (u'YOUR_TEMPLATE_DIR',), u'OPTIONS': {u'builtins': [u'mezzanine.template.loader_tags'], u'context_processors': (u'django.contrib.auth.context_processors.auth', u'django.contrib.messages.context_processors.messages', u'django.core.context_processors.debug', u'django.core.context_processors.i18n', u'django.core.context_processors.static', u'django.core.context_processors.media', u'django.core.context_processors.request', u'django.core.context_processors.tz', u'mezzanine.conf.context_processors.settings', u'mezzanine.pages.context_processors.page')}}]
再度コマンドを
実行 python manage.py makemigrations request
OUTPUT
まだ、警告が 出力されます。
デフォルトで使っていた
TEMPLATE_DIRS, TEMPLATE_CONTEXT_PROCESSORSを
TEMPLATESに追加しなさいと いう ことでしょうか..
WARNINGS: ?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DIRS, TEMPLATE_CONTEXT_PROCESSORS.
TEMPLATE_DIRS,TEMPLATE_CONTEXT_PROCESSORS
がそのままに なっていたので、 コメントアウト
DjangoかMezzanineが出力してくている、
u'DIRS': (u'YOUR_TEMPLATE_DIR',),
は、
os.path.join(PROJECT_ROOT, “templates”)が展開されて パスが 出力されているようです。
# Put strings here, like "/home/html/django_templates" # or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. #TEMPLATE_DIRS = ( # os.path.join(PROJECT_ROOT, "templates"),) # List of processors used by RequestContext to populate the context. # Each one should be a callable that takes the request object as its # only parameter and returns a dictionary to add to the context. #TEMPLATE_CONTEXT_PROCESSORS = ( # "django.contrib.auth.context_processors.auth", # "django.contrib.messages.context_processors.messages", # "django.core.context_processors.debug", # "django.core.context_processors.i18n", # "django.core.context_processors.static", # "django.core.context_processors.media", # "django.core.context_processors.request", # "django.core.context_processors.tz", # "mezzanine.conf.context_processors.settings", # "mezzanine.pages.context_processors.page", #)
- 再度コマンドを
実行
警告が消えた ことを 確認しました。
python manage.py makemigrations request
以上です。
コメント