On 21 jan, 21:36, Edwin <edwinja...@gmail.com> wrote:
> I have an app that's called the same way as my project name

Won't work.


(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

A Django project is a Python package, a Django app is Python package,
so if they are named the same one is always going to shadow the other.
Read about the Python's module search path and you'll understand why.
So it's mostly a Python problem, not a Django one, even if the way
Django imports the app's models at startup doesn't help.

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

Obviously, rename your project ;)

> 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'

You should only refer to the app's name when doing imports, ie
"blog.admin', 'books.models' etc.

-- 
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