dev
dev

Reputation: 311

Getting error when run django server

I am trying to make my app using django. I have set my setting.py file aas below mention code. when I have tried to run server getting below mentioned error, to resolve this I have tried all things like removed django folder and other thing but the error is still not resolved.

error in terminal

Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fc0902866a8>
Traceback (most recent call last):
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/utils.py", line 64, in __getitem__
    return self._engines[alias]
KeyError: 'django'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/backends/django.py", line 121, in get_package_libraries
    module = import_module(entry[1])
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/ajay/.local/lib/python3.5/site-packages/django/templatetags/future.py", line 4, in <module>
    from django.utils.deprecation import RemovedInDjango110Warning
ImportError: cannot import name 'RemovedInDjango110Warning'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ajay/.local/lib/python3.5/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/home/ajay/.local/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run
    self.check(display_num_errors=True)
  File "/home/ajay/.local/lib/python3.5/site-packages/django/core/management/base.py", line 364, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/ajay/.local/lib/python3.5/site-packages/django/core/management/base.py", line 351, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/ajay/.local/lib/python3.5/site-packages/django/core/checks/registry.py", line 73, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/ajay/.local/lib/python3.5/site-packages/admin_tools/checks.py", line 18, in check_admin_tools_configuration
    get_template('admin:admin/base.html')
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/loader.py", line 12, in get_template
    engines = _engine_list(using)
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/loader.py", line 66, in _engine_list
    return engines.all() if using is None else [engines[using]]
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/utils.py", line 88, in all
    return [self[alias] for alias in self]
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/utils.py", line 88, in <listcomp>
    return [self[alias] for alias in self]
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/utils.py", line 79, in __getitem__
    engine = engine_cls(params)
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/backends/django.py", line 25, in __init__
    options['libraries'] = self.get_templatetag_libraries(libraries)
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries
    libraries = get_installed_libraries()
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries
    for name in get_package_libraries(pkg):
  File "/home/ajay/.local/lib/python3.5/site-packages/django/template/backends/django.py", line 125, in get_package_libraries
    "trying to load '%s': %s" % (entry[1], e)
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'django.templatetags.future': cannot import name 'RemovedInDjango110Warning'

setting.py

   # Application definition

INSTALLED_APPS = (
    'admin_tools',
    'admin_tools.theming',
    'admin_tools.menu',
    'admin_tools.dashboard',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'snippets',
    'rest_framework'
)
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    #'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
 TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [os.path.join(BASE_DIR, 'templates')],
            'APP_DIRS': False,
            'OPTIONS': {
                'context_processors': [
                    'django.template.context_processors.debug',
                    'django.template.context_processors.request',
                    'django.contrib.auth.context_processors.auth',
                    'django.contrib.messages.context_processors.messages',
                ],
                'loaders' : [
                    'django.template.loaders.filesystem.Loader',
                    'django.template.loaders.app_directories.Loader',
                    'admin_tools.template_loaders.Loader',
                    ]
            },
        },
    ]

Upvotes: 0

Views: 1908

Answers (1)

py-D
py-D

Reputation: 669

As per this, django/templatetags/future.py was removed in 1.10. You seem to have files from multiple versions of Django. Try uninstalling Django and removing the django/ folder, and then reinstalling 1.10.

Upvotes: 1

Related Questions