|Version 5 (modified by 12 years ago) (diff),|
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
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'.
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.
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.
Blank object names
The automatic admin interface is showing nothing (or a single
) in the "Select [object_type] to change" view.
You may have forgotten to create a
__repr__() function for your model. Django calls
__repr__() to find out how to display objects in the admin interface.
__repr__() function to all your models. Make it a habit so it becomes automatic.