Opened 16 years ago
Closed 16 years ago
#7909 closed (duplicate)
newforms errors are a little ambiguous
Reported by: | dthole | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Here is the setup that I'm using right now:
app/forms.py
app/urls.py
app/views/*.py
app/models/*.py
app/templates/*.html
What happened this evening was a typo, but the resulting error message was incredibly vague. Here is the relevant code, including the error I created:
app/urls.py does not have any reference to the newforms, but the views obviously do.
app/forms.py
class Search(form.Form):
....
The resulting error was the following:
ImproperlyConfigured at /
Error while importing URLconf 'sitecode.app.urls': name 'form' is not defined
Traceback:
/usr/lib/python2.5/site-packages/django/core/handlers/base.py in get_response
/usr/lib/python2.5/site-packages/django/core/urlresolvers.py in resolve
/usr/lib/python2.5/site-packages/django/core/urlresolvers.py in resolve
/usr/lib/python2.5/site-packages/django/core/urlresolvers.py in _get_urlconf_module
This is with the current version of SVN (updated before the ticket).
To reproduce the problem:
- Misspell forms to form
- Run manage.py runserver
I'll probably branch this into my own tree for now and can provide more information if required. I personally feel that the error seems to point to the wrong place. Since the form is probably imported in this area, that's where the error happens. Which, totally makes sense. urls.py doesn't import this file, but other files that urls.py do import will import this file. I'm not sure if there's a good way to fix it, but I figured I'd bring it up since I can tell it'd definitely be a source of frustration for some.
Duplicate of #7524.