django-fluent/django-fluent-blogs

Circular imports (?) exposed when DEBUG=False

Closed this issue · 3 comments

Django version is 1.5.4
django-fluent-blogs version is 0.9.6

Works fine with DEBUG=True, but with DEBUG=False there are ImportErrors. (I gather Django imports things slightly differently in these two cases.):

[25/Sep/2013 08:40:36] ERROR [django.request:212] Internal Server Error: /
Traceback (most recent call last):
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 103, in get_response
    resolver_match = resolver.resolve(request.path_info)
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 319, in resolve
    for pattern in self.url_patterns:
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 347, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 342, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "./ccnew/urls.py", line 10, in <module>
    admin.autodiscover()
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 29, in autodiscover
    import_module('%s.admin' % app)
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/fluent_blogs/admin/__init__.py", line 2, in <module>
    from fluent_blogs.admin.entryadmin import AbstractEntryBaseAdmin, EntryAdmin, AbstractEntryBaseAdminForm
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/fluent_blogs/admin/entryadmin.py", line 10, in <module>
    from fluent_blogs.base_models import AbstractEntryBase
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/fluent_blogs/base_models.py", line 9, in <module>
    from fluent_blogs.models.managers import EntryManager
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/fluent_blogs/models/__init__.py", line 1, in <module>
    from .db import Entry, AbstractEntry, get_entry_model, get_category_model
  File "/home/al/venvs/cc/local/lib/python2.7/site-packages/fluent_blogs/models/db.py", line 4, in <module>
    from fluent_blogs.base_models import AbstractEntry, CommentsEntryMixin
ImportError: cannot import name AbstractEntry

Yikes! You're running into more issues then I expected. I'm checking it out.

I've just release django-fluent-blogs 0.9.7 on PyPI, which has this fix (and a few small others) included.

There is also an example app in the repository now, both in the "master" branch (which has experimental multilingual support), and the v0.9.x branch.

Again, thanks for such a speedy fix and release. Will check it out.