1👍
✅
You named your view incorrectly in the URL dispatch:
from usuarios.views import Registro
urlpatterns = patterns('',
# ...
url(r'^registro/$', 'Registro', name='registro'),
Here 'Registro'
is not a name Django can import (it is not a full module path), nor did you specify a prefix to import from (the first argument to patterns()
is an empty string ''
).
You should either give the actual view object (that you already imported here), or give it the name for the full module path.
So pick one of:
from usuarios.views import Registro
urlpatterns = patterns('',
# ...
url(r'^registro/$', Registro, name='registro'),
or
urlpatterns = patterns('',
# ...
url(r'^registro/$', 'usuarios.views.Registro', name='registro'),
The first option passes the actual view function to the register (which works because you imported it already).
The second option gives the full path to the module in addition to the view name; Django can now import that (it looks for the .
in the string to determine if something can be imported).
Source:stackexchange.com