Using Django 1.4 and django-auth-ldap 1.1, I'm trying to configure my web app to authenticate users against an LDAP service. On supplying the correct login credentials in the login form, I'm getting this error :-
TypeError at /login/
an integer is required
Request Method: POST
Request URL: http://mydomain.com:8000/login/
Django Version: 1.4
Exception Type: TypeError
Exception Value:
an integer is required
Exception Location: /usr/lib/python2.6/dist-packages/ldap/functions.py in _ldap_function_call, line 57
Python Executable: /usr/bin/python
Python Version: 2.6.5
....Python Path information
Why is this error happening ?
Here is the pasted trace info :-
Environment:
Request Method: POST
Request URL: http://localhost:8000/login/
Django Version: 1.4
Python Version: 2.6.5
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'myapp')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/debug.py" in wrapper
69. return view(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py" in _wrapped_view
91. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
89. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/views.py" in login
36. if form.is_valid():
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in is_valid
124. return self.is_bound and not bool(self.errors)
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in _get_errors
115. self.full_clean()
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in full_clean
271. self._clean_form()
File "/usr/local/lib/python2.6/dist-packages/django/forms/forms.py" in _clean_form
299. self.cleaned_data = self.clean()
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/forms.py" in clean
167. password=password)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/__init__.py" in authenticate
43. for backend in get_backends():
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/__init__.py" in get_backends
34. backends.append(load_backend(backend_path))
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/__init__.py" in load_backend
28. return cls()
File "/usr/local/lib/python2.6/dist-packages/django_auth_ldap-1.1.1-py2.6.egg/django_auth_ldap/backend.py" in __init__
93. self.ldap = self.ldap_module()
File "/usr/local/lib/python2.6/dist-packages/django_auth_ldap-1.1.1-py2.6.egg/django_auth_ldap/backend.py" in ldap_module
104. return _LDAPConfig.get_ldap(options)
File "/usr/local/lib/python2.6/dist-packages/django_auth_ldap-1.1.1-py2.6.egg/django_auth_ldap/config.py" in get_ldap
74. cls.ldap.set_option(opt, value)
File "/usr/lib/python2.6/dist-packages/ldap/functions.py" in set_option
124. _ldap_function_call(_ldap.set_option,option,invalue)
File "/usr/lib/python2.6/dist-packages/ldap/functions.py" in _ldap_function_call
57. result = func(*args,**kwargs)
Exception Type: TypeError at /login/
Exception Value: an integer is required
Your LDAP server is complaining about one of the key/value pairs in your AUTH_LDAP_GLOBAL_OPTIONS. Make sure you're using the ldap.OPT_* constants as the dictionary keys.
Related
I am using cookie cutter Django and on the url http://localhost:8000/accounts/login/ whenever I enter a wrong password I am getting the following traceback and a 500 Internal Server Error on the network console. I am using sqlite database. I am not able to understand why I am getting this error because when I create an empty project using the same database no such error is thrown.
Environment:
Request Method: POST
Request URL: http://localhost:8000/accounts/login/
Django Version: 2.1.4
Python Version: 3.6.7
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'crispy_forms',
'allauth',
'allauth.account',
'allauth.socialaccount',
'rest_framework',
'widget_tweaks',
'core.users.apps.UsersAppConfig',
'core.userManagement.apps.UsermanagementConfig',
'debug_toolbar',
'django_extensions']
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',
'debug_toolbar.middleware.DebugToolbarMiddleware']
Traceback:
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/allauth/account/views.py" in dispatch
137. return super(LoginView, self).dispatch(request, *args, **kwargs)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/allauth/account/views.py" in dispatch
80. **kwargs)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/allauth/account/views.py" in post
102. if form.is_valid():
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/forms/forms.py" in is_valid
185. return self.is_bound and not self.errors
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/forms/forms.py" in errors
180. self.full_clean()
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/forms/forms.py" in full_clean
382. self._clean_form()
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/forms/forms.py" in _clean_form
409. cleaned_data = self.clean()
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/allauth/account/forms.py" in clean
179. **credentials)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/allauth/account/adapter.py" in authenticate
489. user = authenticate(request, **credentials)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/contrib/auth/__init__.py" in authenticate
73. user = backend.authenticate(request, **credentials)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/allauth/account/auth_backends.py" in authenticate
26. ret = self._authenticate_by_username(**credentials)
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/allauth/account/auth_backends.py" in _authenticate_by_username
40. user = filter_users_by_username(username).get()
File "/home/power/Documents/Projects/core/venv/lib/python3.6/site-packages/django/db/models/query.py" in get
403. (self.model._meta.object_name, num)
Exception Type: MultipleObjectsReturned at /accounts/login/
Exception Value: get() returned more than one User -- it returned 2!
I was trying to add django-allauth to my Django web app and I am getting an error when trying to sign up. The error happens when sending the email. The domain variable at that point is getting my computer's name (I am working in locahost) that has a non-ascii character. The error is being raised in the core.mail module of Django. How could I fix this?
Thanks in advance.
Environment:
Request Method: POST
Request URL: http://localhost:8000/accounts/signup/
Django Version: 1.8.1
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.contrib.sites',
'django_extensions',
'debug_toolbar',
'sorl.thumbnail',
'core',
'authentication',
'allauth',
'allauth.account',
'allauth.socialaccount')
Installed Middleware:
(u'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/views/generic/base.py" in view
71. return self.dispatch(request, *args, **kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
34. return bound_func(*args, **kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
30. return func.__get__(self, type(self))(*args2, **kwargs2)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/views.py" in dispatch
169. return super(SignupView, self).dispatch(request, *args, **kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/views.py" in dispatch
66. **kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/views.py" in dispatch
147. **kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
89. return handler(request, *args, **kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/views.py" in post
82. response = self.form_valid(form)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/views.py" in form_valid
185. self.get_success_url())
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/utils.py" in complete_signup
157. signal_kwargs=signal_kwargs)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/utils.py" in perform_login
114. send_email_confirmation(request, user, signup=signup)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/utils.py" in send_email_confirmation
286. signup=signup)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/models.py" in send_confirmation
60. confirmation.send(request, signup=signup)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/models.py" in send
137. ctx)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/allauth/account/adapter.py" in send_mail
101. msg.send()
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/core/mail/message.py" in send
304. return self.get_connection(fail_silently).send_messages([self])
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/core/mail/backends/console.py" in send_messages
36. self.write_message(message)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/core/mail/backends/console.py" in write_message
18. msg = message.message()
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/core/mail/message.py" in message
284. msg['Message-ID'] = make_msgid(domain=DNS_NAME)
File "/Users/user/.virtualenvs/app/lib/python2.7/site-packages/django/core/mail/message.py" in make_msgid
64. msgid = '<%s.%s.%s%s#%s>' % (utcdate, pid, randint, idstring, domain)
Exception Type: UnicodeDecodeError at /accounts/signup/
Exception Value: 'ascii' codec can't decode byte 0xc3 in position 18: ordinal not in range(128)
I answer my own question. This is an existing issue with python (Issue 9377). Basically, it is necessary to change your computer's name to something without non-ASCII characters. My recommendation is to do it through the terminal with the next command: sudo scutil --set HostName [NewHostNameHere]. Probably will also be required restarting the computer.
ImportError at /complete/twitter/
No module named social.pipeline
i had this error when i was trying to connect twitter to my project this is the full traceback
any body has any idea how to solve it
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/complete/twitter/? oauth_token=gqaWZAszthiQJEUaZHF72U1y7hGimCLGSGxr6YLUU&oauth_verifier=YAkKy9Q71YrScl1psUXBApx XeQITAcDm6ObCoxdjc
Django Version: 1.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'tager_www',
'fbregister',
'captcha',
'django_twilio',
'social_auth')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py" in wrapped_view
77. return view_func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23- py2.7.egg/social_auth/decorators.py" in wrapper
29. return func(request, request.social_auth_backend, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23- py2.7.egg/social_auth/views.py" in complete
41. return complete_process(request, backend, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/views.py" in complete_process
107. user = auth_complete(request, backend, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/views.py" in auth_complete
190. return backend.auth_complete(user=user, request=request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/twitter.py" in auth_complete
87. return super(TwitterAuth, self).auth_complete(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/__init__.py" in auth_complete
656. return self.do_auth(access_token, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/__init__.py" in do_auth
672. return authenticate(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py" in authenticate
59. user = backend.authenticate(**credentials)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/__init__.py" in authenticate
107. out = self.pipeline(pipeline, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.23-py2.7.egg/social_auth/backends/__init__.py" in pipeline
132. mod = import_module(mod_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
35. __import__(name)
Exception Type: ImportError at /complete/twitter/
Exception Value: No module named social.pipeline
form settings.py :
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.associate.associate_by_email',
'social_auth.backends.pipeline.misc.save_status_to_session',
'social.pipeline.redirect_to_form',
'social.pipeline.username',
'social_auth.backends.pipeline.user.create_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.social.load_extra_data',
'social_auth.backends.pipeline.user.update_user_details',
'social_auth.backends.pipeline.misc.save_status_to_session',
'social.pipeline.redirect_to_form2',
'social.pipeline.first_name',
)
Not directly related to the question, but this is the only related page Google showed when searching for this error so I'll post this hoping that someone making the same mistake will see it. The error I was getting was:
ImportError at /complete/facebook/
No module named pipeline.social_auth
I got this error because I was trying to use the django-social-auth pipelines with python-social-auth. If you are using python-social-auth, you will need the following:
SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
#'social.pipeline.social_auth.associate_by_email',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details'
)
More details can be found here.
Thanks for looking into this. I'm very new to Django and LDAP Config....so any help is greatly appreciated!
ActivePython 2.6, Django-1.2.7, openldap-2.4.23, python-ldap
So i have the Django installed. I'm trying to configure LDAP to it by following this instruction http://djangosnippets.org/snippets/901/.
After making making changes as described in the above document, and when i run 'python manage.py runserver' I'm gettting this error. Any idea why this is happening? Been looking at this for about a week and no idea how to get this fixed.
Error:
ValueError at /admin/
option error
Request Method: POST
Request URL: http://0.0.0.0:8080/admin/
Django Version: 1.2.7
Exception Type: ValueError
Exception Value:
option error
Exception Location: /apps/essw/python/lib/python2.6/site-packages/python_ldap-2.4.10-py2.6-linux-x86_64.egg/ldap/functions.py in _ldap_function_call, line 63
Python Executable: /apps/essw/python/bin/python
Python Version: 2.6.7
Python Path: ['/apps/essw/mysite', '/apps/essw/python/lib/python2.6/site-packages/python_ldap-2.4.10-py2.6-linux-x86_64.egg', '/apps/essw/python/lib/python2.6/site-packages/elementtree-1.2.7_20070827_preview-py2.6.egg', '/apps/essw/python/lib/python2.6/site-packages/Markdown-2.2.0-py2.6.egg', '/apps/essw/python/lib/python2.6/site-packages/html5lib-0.95-py2.6.egg', '/apps/essw/python/lib/python26.zip', '/apps/essw/python/lib/python2.6', '/apps/essw/python/lib/python2.6/plat-linux2', '/apps/essw/python/lib/python2.6/lib-tk', '/apps/essw/python/lib/python2.6/lib-old', '/apps/essw/python/lib/python2.6/lib-dynload', '/apps/essw/python/lib/python2.6/site-packages', '/apps/essw/python/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']
Server time: Wed, 25 Jul 2012 09:06:41 -0500
#ChrisPratt Thanks for the reply Chris! See if this is helpful
Environment:
Request Method: POST
Request URL: http://x.x.x.x:8080/admin/
Django Version: 1.2.7
Python Version: 2.6.7
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.admindocs']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/apps/essw/python/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
100. response = callback(request, *callback_args, **callback_kwargs)
File "/apps/essw/python/lib/python2.6/site-packages/django/contrib/admin/sites.py" in wrapper
208. return self.admin_view(view, cacheable)(*args, **kwargs)
File "/apps/essw/python/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapped_view
76. response = view_func(request, *args, **kwargs)
File "/apps/essw/python/lib/python2.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
78. response = view_func(request, *args, **kwargs)
File "/apps/essw/python/lib/python2.6/site-packages/django/contrib/admin/sites.py" in inner
190. return self.login(request)
File "/apps/essw/python/lib/python2.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
78. response = view_func(request, *args, **kwargs)
File "/apps/essw/python/lib/python2.6/site-packages/django/contrib/admin/sites.py" in login
323. user = authenticate(username=username, password=password)
File "/apps/essw/python/lib/python2.6/site-packages/django/contrib/auth/__init__.py" in authenticate
52. user = backend.authenticate(**credentials)
File "/apps/essw/mysite/django_auth_ldap/backend.py" in authenticate
824. ldap.set_option(ldap.OPT_X_TLS_CACERTFILE,settings.AD_CERT_FILE)
File "/apps/essw/python/lib/python2.6/site-packages/python_ldap-2.4.10-py2.6-linux- x86_64.egg/ldap/functions.py" in set_option
132. return _ldap_function_call(None,_ldap.set_option,option,invalue)
File "/apps/essw/python/lib/python2.6/site-packages/python_ldap-2.4.10-py2.6-linux- x86_64.egg/ldap/functions.py" in _ldap_function_call
63. result = func(*args,**kwargs)
Exception Type: ValueError at /admin/
Exception Value: option error
I am unable to access the admin interface in django 1.1.1 using localloop:8000/admin. It was working fine on Ubuntu 8.4 then I upgraded to Ubuntu 10.10 and the problem occurred.
In settings.py I have:
import os.path
PROJECT_DIR=os.path.dirname(__file__)
TEMPLATE_DIRS =(os.path.join(PROJECT_DIR,'templates'))
This was working fine on Ubuntu 8.04 but not in Ubuntu 10.10.
Any ideas on what goes wrong? Here is the traceback:
Environment:
Request Method: GET
Request URL: http://localhost:8000/admin/
Django Version: 1.1.1
Python Version: 2.6.6
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'hotweb.accounts',
'django.contrib.flatpages',
'messages',
'hotweb.jchat']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.middleware.http.SetRemoteAddrFromForwardedFor')
Template Loader Error:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.load_template_source:
/home/scorpion/Desktop/hotweb/templates/admin/index.html (File does not exist)
Using loader django.template.loaders.app_directories.load_template_source:
/usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/admin/index.html (File exists)
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py" in wrapper
196. return self.admin_view(view, cacheable)(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py" in inner
186. return view(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py" in index
374. context_instance=context_instance
File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/__init__.py" in render_to_response
20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in render_to_string
103. t = get_template(template_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in get_template
81. source, origin = find_template_source(template_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in find_template_source
74. raise TemplateDoesNotExist, name
Exception Type: TemplateDoesNotExist at /admin/
Exception Value: admin/index.html
here is the trace back
Environment:
Request Method: GET
Request URL: http://localhost:8000/admin/
Django Version: 1.1.1
Python Version: 2.6.6
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'hotweb.accounts',
'django.contrib.flatpages',
'messages',
'hotweb.jchat']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'django.middleware.http.SetRemoteAddrFromForwardedFor')
Template Loader Error:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.load_template_source:
/home/scorpion/Desktop/hotweb/templates/admin/index.html (File does not exist)
Using loader django.template.loaders.app_directories.load_template_source:
/usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/admin/index.html (File exists)
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py" in wrapper
196. return self.admin_view(view, cacheable)(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py" in inner
186. return view(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py" in index
374. context_instance=context_instance
File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/__init__.py" in render_to_response
20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in render_to_string
103. t = get_template(template_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in get_template
81. source, origin = find_template_source(template_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in find_template_source
74. raise TemplateDoesNotExist, name
Exception Type: TemplateDoesNotExist at /admin/
Exception Value: admin/index.html
Ensure that APP_DIRS is set to True in the Templates
Hmm, that's odd since TEMPLATE_DIRS setting doesn't have anything to do with the admin app.
If you're sure it's those 3 lines, the only possible thing I see wrong is TEMPLATE_DIRS is supposed to be a tuple (yours is a string), but on 1.2.3 it doesn't cause any problems.
You say "the problem occurred in settings.py"... but
I don't see where a TemplateDoesNotExist error would appear from the lines you pasted -- can you post the full traceback? Which line of code triggered TemplateDoesNotExist? How do you know it was settings.py?
I think the problem lies outside of your 3 lines.
PS: I can't comment since I have <50 rep.