파이썬 및 django .i이 새로운 장고 등록 모듈의 코드를 이해하고 싶습니다. 코드에서 값을 디버깅하고 싶습니다. 그래서 내가어떻게 변수 값을 디버깅 할 수 있습니다 __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 값을 볼 수 있습니까?
이
코드입니다 :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()
먼저 파이썬을 알아보세요. 웹에는 수많은 자원이 있습니다. – seler