#19483 closed Cleanup/optimization (fixed)
ImportError is misinterpreted (in contrib.comments)
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | contrib.comments | Version: | 1.4 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Hi,
I kept having this error when running "./manage.py runserver" on a project:
progval@Andromede:~/workspace/lqdn/memopol2-0$ ./manage.py runserver
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 217, in execute
translation.activate('en-us')
File "/usr/lib/python2.7/dist-packages/django/utils/translation/__init__.py", line 105, in activate
return _trans.activate(language)
File "/usr/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 194, in activate
_active.value = translation(language)
File "/usr/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 183, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/usr/lib/python2.7/dist-packages/django/utils/translation/trans_real.py", line 160, in _fetch
app = import_module(appname)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/haystack/__init__.py", line 154, in <module>
handle_registrations()
File "/usr/local/lib/python2.7/dist-packages/haystack/__init__.py", line 151, in handle_registrations
search_sites_conf = importlib.import_module(settings.HAYSTACK_SITECONF)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/progval/workspace/lqdn/memopol2-0/memopol/search/search_indexes.py", line 4, in <module>
from memopol.meps.models import MEP
File "/home/progval/workspace/lqdn/memopol2-0/memopol/meps/models.py", line 4, in <module>
from django.contrib.comments.moderation import CommentModerator, moderator
File "/usr/lib/python2.7/dist-packages/django/contrib/comments/moderation.py", line 356, in <module>
moderator = Moderator()
File "/usr/lib/python2.7/dist-packages/django/contrib/comments/moderation.py", line 281, in __init__
self.connect()
File "/usr/lib/python2.7/dist-packages/django/contrib/comments/moderation.py", line 289, in connect
signals.comment_will_be_posted.connect(self.pre_save_moderation, sender=comments.get_model())
File "/usr/lib/python2.7/dist-packages/django/contrib/comments/__init__.py", line 41, in get_model
if get_comment_app_name() != DEFAULT_COMMENTS_APP and hasattr(get_comment_app(), "get_model"):
File "/usr/lib/python2.7/dist-packages/django/contrib/comments/__init__.py", line 25, in get_comment_app
raise ImproperlyConfigured("The COMMENTS_APP setting refers to "\
django.core.exceptions.ImproperlyConfigured: The COMMENTS_APP setting refers to a non-existing package.
After loads of debugging, I editted django/contrib/comments/init.py: I replaced this:
try:
package = import_module(comments_app)
exce*pt ImportError:
raise ImproperlyConfigured("The COMMENTS_APP setting refers to "\
"a non-existing package.")
by this:
package = import_module(comments_app)
And I got:
progval@Andromede:~/workspace/lqdn/memopol2-0$ ./manage.py runserver Error: No module named gunicorn
I have no idea how to solve this, but you could display the name of the module in the error message, it would help a lot.
Regards,
Valentin
Change History (5)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
| Summary: | ImportError is misinterpreted → ImportError is misinterpreted (in contrib.comments) |
|---|
comment:3 by , 13 years ago
| Component: | Uncategorized → contrib.comments |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → Cleanup/optimization |
comment:4 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
For instance:
try: package = import_module(comments_app) except ImportError as e: raise ImproperlyConfigured("The COMMENTS_APP setting refers to "\ "a non-existing package: %s" % e.args[0])