我最近开始学习 Django,发现它非常有用。但是有一个问题:我不知道如何正确调试网站!
例如,我下载了一些示例并尝试设置它们。但是当我访问该站点时,我得到了这个回溯。这根本没有帮助——我知道 Python 抱怨“str object is not callable”。但它是如何触发的?我做了什么导致该函数调用?
有没有一种简单的方法来调试 Django 网站?
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.4.3
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'forum',
'registration')
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.7/dist-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
Exception Type: TypeError at /
Exception Value: 'str' object is not callable