J'ai installé la bibliothèque Django-Paypal en utilisant pip, mais après cela, ma version originale de Django est mise à niveau et, à cause de cela, mon code en cours d'exécution renvoyait une erreur.
J'ai donc désinstallé Django-Paypal. Mais je reçois toujours la même erreur. L'erreur est
Import Error: No module named context_processors
Mon ancienne version de Django est 1.8.7
Maintenant, il est mis à niveau à 1.10
Messages d'erreur:
Unhandled exception in thread started by <function wrapper at 0x7f7cb8032410>
Traceback (most recent call last):
File "/home/v08/.local/lib/python2.7/site-packages/Django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/v08/.local/lib/python2.7/site-packages/Django/core/management/commands/runserver.py", line 121, in inner_run
self.check(display_num_errors=True)
File "/home/v08/.local/lib/python2.7/site-packages/Django/core/management/base.py", line 385, in check
include_deployment_checks=include_deployment_checks,
File "/home/v08/.local/lib/python2.7/site-packages/Django/core/management/base.py", line 372, in _run_checks
return checks.run_checks(**kwargs)
File "/home/v08/.local/lib/python2.7/site-packages/Django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/v08/.local/lib/python2.7/site-packages/Django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/home/v08/.local/lib/python2.7/site-packages/Django/core/checks/urls.py", line 24, in check_resolver
for pattern in resolver.url_patterns:
File "/home/v08/.local/lib/python2.7/site-packages/Django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/v08/.local/lib/python2.7/site-packages/Django/urls/resolvers.py", line 310, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/v08/.local/lib/python2.7/site-packages/Django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/v08/.local/lib/python2.7/site-packages/Django/urls/resolvers.py", line 303, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/v08/Django/FirstProject/FirstProject/urls.py", line 25, in <module>
url(r'^', include('Car.urls')),
File "/home/v08/.local/lib/python2.7/site-packages/Django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/v08/Django/FirstProject/Car/urls.py", line 2, in <module>
from . import views
File "/home/v08/Django/FirstProject/Car/views.py", line 7, in <module>
from Django.core.context_processors import csrf
ImportError: No module named context_processors
Setting.py pour Django1.8: - dans TEMPLATES
'Django.template.context_processors.debug',
'Django.template.context_processors.request',
'Django.contrib.auth.context_processors.auth',
'Django.contrib.messages.context_processors.messages',
'Django.core.context_processors.i18n',
'Django.core.context_processors.media',
'Django.core.context_processors.static',
'Django.core.context_processors.tz',
J'ai eu le problème suivant les modifications doivent être effectuées dans le fichier setting .py
Setting.py pour Django1.10: - dans TEMPLATES
'Django.contrib.auth.context_processors.auth',
'Django.template.context_processors.debug',
'Django.template.context_processors.i18n',
'Django.template.context_processors.media',
'Django.template.context_processors.static',
'Django.template.context_processors.tz',
'Django.contrib.messages.context_processors.messages',
et changement de views.py
: -
Code de la version 1.8: -
from Django.core.context_processors import csrf
from Django.core.context_processors import csrf
code version 1.10: -
from Django.views.decorators import csrf
from Django.views.decorators.csrf import csrf_protect