Version 4 (modified by 19 years ago) ( diff ) | ,
---|
NewbieMistakes
Please feel free to share the things that tripped you up when you started with Django. We'll try to improve Django's error handling to catch such mistakes in the future.
URLconf include() misbehaving
Symptom
You're trying to get your URLconf files to work, but getting cryptic errors about how there is no module 'index' (where 'index' is some function you are trying to assign as a view), or module 'foo' has no attribute 'urlpatterns'.
Probable cause
You may have tried to load your view files using include() in the URLconf file (in tutorial 3, this is myproject/settings/urls/main.py). The include() call assumes that the file it's loading is also a URLconf file.
Solution
Remove the include(). Just give the module and function name (e.g., 'myproject.apps.polls.views.polls.index'
) as a string, with no include() around it.