Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'module' object is not callable #202

Closed
NothinkingGao opened this issue May 28, 2017 · 4 comments
Closed

'module' object is not callable #202

NothinkingGao opened this issue May 28, 2017 · 4 comments

Comments

@NothinkingGao
Copy link

NothinkingGao commented May 28, 2017


'module' object is not callable

Request Method: 	GET
Request URL: 	http://127.0.0.1:8000/admin/
Django Version: 	1.10.6
Exception Type: 	TypeError
Exception Value: 	

'module' object is not callable

Exception Location: 	/usr/local/lib/python2.7/dist-packages/django/template/utils.py in __getitem__, line 80
Python Executable: 	/usr/bin/python
Python Version: 	2.7.6
Python Path: 	

['/home/www/mao',
 '/usr/local/lib/python2.7/dist-packages/django_ckeditor-5.2.1-py2.7.egg',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

Server time: 	Sun, 28 May 2017 12:19:05 +0000`

trace is

alias 	

'backend'

backend 	

'
django_jinja.backend.jinja2'

engine_cls 	

<module 'jinja2' from '/usr/local/lib/python2.7/dist-packages/jinja2/__init__.pyc'>

params 	

{'APP_DIRS': True,
 'DIRS': ['/home/www/mao/shop/templates'],
 'NAME': 'backend',
 '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'],
             'match_extension': '.jinja'}}

self 	

<django.template.utils.EngineHandler object at 0x7f083ccbdf90>
settings.py
`TEMPLATES = [
    {
        'BACKEND': 'django_jinja.backend.jinja2',
        'DIRS': [os.path.join(BASE_DIR,'shop/templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            "match_extension":".jinja",
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },

my django version is 1.11.1,I try again and again and can not solve it,can you help me?

@niwinz
Copy link
Owner

niwinz commented May 28, 2017

Without a complete stack trace is very complicated guess the real problem. Can you paste please the complete stack trace?

@NothinkingGao
Copy link
Author

ok

TypeError at /

'module' object is not callable

Request Method: 	GET
Request URL: 	http://192.168.199.101:8080/
Django Version: 	1.10.6
Exception Type: 	TypeError
Exception Value: 	

'module' object is not callable

Exception Location: 	/usr/local/lib/python2.7/dist-packages/django/template/utils.py in __getitem__, line 80
Python Executable: 	/usr/local/bin/uwsgi
Python Version: 	2.7.6
Python Path: 	

['.',
 '',
 '/usr/local/lib/python2.7/dist-packages/django_ckeditor-5.2.1-py2.7.egg',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

Server time: 	Fri, 2 Jun 2017 00:14:16 +0000
Environment:


Request Method: GET
Request URL: http://192.168.199.101:8080/

Django Version: 1.10.6
Python Version: 2.7.6
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_jinja',
 'shop']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
  42.             response = get_response(request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "./shop/views.py" in index
  26. 	return render(request,'index/index.html',context)

File "/usr/local/lib/python2.7/dist-packages/django/shortcuts.py" in render
  30.     content = loader.render_to_string(template_name, context, request, using=using)

File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in render_to_string
  67.         template = get_template(template_name, using=using)

File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in get_template
  18.     engines = _engine_list(using)

File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in _engine_list
  72.     return engines.all() if using is None else [engines[using]]

File "/usr/local/lib/python2.7/dist-packages/django/template/utils.py" in all
  89.         return [self[alias] for alias in self]

File "/usr/local/lib/python2.7/dist-packages/django/template/utils.py" in __getitem__
  80.             engine = engine_cls(params)

Exception Type: TypeError at /
Exception Value: 'module' object is not callable

@NothinkingGao
Copy link
Author

It looks like can not load jinja module

@niwinz
Copy link
Owner

niwinz commented Apr 13, 2018

The errors are happens on the django template engine and not the jinja one, seems unrelared to jinja

@niwinz niwinz closed this as completed Apr 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants