I have an app that's called the same way as my project name (let's
name it 'blog'). My directory structure is:

blog
   apps
      blog
          models.py
      books
          management
          models.py


Everything works fine except that when i created a custom command
inside another app, call it 'books', Django can't find it.. as it
turns out, somehow django gets confused and the project root path for
searching apps in the management tool
(django.core.management.__init__.py) becomes blog.apps.blog instead of
just blog as the project name. This results in django can't find of my
custom commands inside books app because it's searching on a wrong
path!

One thing to mention is that in my INCLUDED_APPS, i define my apps
using its project name as well:
INCLUDED_APPS = (
  'blog.apps.blog',
  'blog.apps.books',
)

This is also one reason why Django can't find my custom command i
guess... but i need to define full path (including project name) here
otherwise I get errors when my AlreadyRegistered from admin because
admin.py is imported twice with different method (when I don't specify
project name in settings.py, django tries to import admin.py using
'apps.blog.admin' and I'm importing it using
'blog.apps.blog.admin')...

My use of import is probably the root cause of everything.. I've heard
various people say that do relative import within apps so that they're
reusable but many Python devs say that always use absolute import. So
tried using absolute import all the time...

I know my question is a bit all over the place here... but can anyone
suggest what to do?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to