Reputation:
I am working on pycharm, with a django project. Whenever I do the "run" thing, and I go to my home page or wherever " http://127.0.0.1:8000/.." Everything works fine, but I get this error :
C:\Users\elmou\AppData\Local\Programs\Python\Python36-32\lib\importlib__init__.py:126: RemovedInDjango110Warning: django.core.context_processors is deprecated in favor of django.template.context_processors. return _bootstrap._gcd_import(name[level:], package, level)
Should I change the django version or what ?! Thanks.
settings.py file :
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.core.context_processors.request',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
Upvotes: 0
Views: 273
Reputation: 308769
The warning is suggesting that you update your context processors in your settings to use django.template.context_processors
instead of django.core.context_processors
.
In your case, it is the request
processor (the first item) that is causing the warning. You already have the new path django.template.context_processors.request
in the list, so just remove django.core.context_processors.request
. Your context processors will then be:
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
If you need more specific instruction like that, then please edit your question to include your list of context processors from your settings file.
Upvotes: 1
Reputation: 289
I think Context Processors used to be listed in their own tuple arrangement in the settings.py in earlier versions of django but this was changed and eventually deprecated in Dango 1.10 hence the RemovedInDjango110Warning.
Now you should list your context processors as options within the Templates setting of your settings.py file. Something that looks a little like this:
TEMPLATES = [
{
'BACKEND': '.......',
'DIRS': '........',
'OPTIONS':{
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
...
...
...
]
},
},
]
The startproject command in later versions should actually set this up for you.
Upvotes: 0
Reputation: 4136
Upvotes: 1