5 | | * Referencing your view files using include() in your URLconf file (in tutorial 3, this is myproject/settings/urls/main.py) will cause the framework to try and load your views as URLconf files. This will give you 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'. |
| 5 | == URLconf include() misbehaving == |
| 6 | |
| 7 | ==== Symptom ==== |
| 8 | |
| 9 | 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'. |
| 10 | |
| 11 | ==== Probable cause ==== |
| 12 | |
| 13 | 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. |
| 14 | |
| 15 | ==== Solution ==== |
| 16 | |
| 17 | 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. |