新的調試變量的值到Python和Django的。我想了解Django的註冊模塊爲了這個,我想調試代碼值的代碼。 所以我卡在這裏,我如何能在__init__.py
i = path.rfind('.')
module, attr = path[:i], path[i+1:]
print {i}
#or
import pdb; pdb.set_trace()
我的登記表不顯示,並給出錯誤。
IndentationError at /accounts/register/
unexpected indent (__init__.py, line 19)
Request Method: GET
Request URL: http://50.56.78.125:8000/accounts/register/
Django Version: 1.3.1
Exception Type: IndentationError
Exception Value:
unexpected indent (__init__.py, line 19)
我該如何調試或看到我的價值。
這是代碼:
i = path.rfind('.')
module, attr = path[:i], path[i+1:]
try:
mod = import_module(module)
except ImportError, e:
raise ImproperlyConfigured('Error loading registration backend %s: "%s"' % (module, e))
try:
backend_class = getattr(mod, attr)
except AttributeError:
raise ImproperlyConfigured('Module "%s" does not define a registration backend named "%s"' % (module, attr))
return backend_class()
第一學習Python。網絡上有無數的資源。 – seler