0

I wanted to change directory of where are my apps. my django project is in this directory:

'/home/user/djcode/dev/myproject'

When I started this project, my apps where in this directory:

'/home/user/djcode/dev/myproject'

Aslo in settings.py I added this line (in INSTALLED_APPS):

'finance',

And everything worked.

Later I wanted to change my apps directory so I moved my apps to:

'/home/user/djcode/dev/myproject/myproject/apps' 

And in settings.py I changed 'finance' into this line (in INSTALLED_APPS):

'myproject.apps.finance'

And when I ran python manage.py runserver command, I got this error:

Error: No module named apps.finance

I know I can just add path directly to where my apps are, so I think it would solve it. But isn't there a way to specify this path without adding it in .pth file?

What I mean is if python knows /home/user/djcode/dev/myproject path why it does not find /home/user/djcode/dev/myproject/myproject/apps?

Maybe I just wrongly specified in installed_apps?

Also I use virtualenv with this project, so django is installed using virtualenv. But I think it's not related, because it finds where my project is, but can't find apps if they are in lower directory lelvels.

3
  • 2
    Or it could be a circular import? Or you might not have a __init__.py in the apps` directory
    – aychedee
    Jan 26, 2013 at 10:10
  • Oh.. How could I forgot about __init__.py.. Thats it. Thank you very much. Now it works:)
    – Andrius
    Jan 26, 2013 at 10:17
  • @aychedee You can post it as answer and I will accept it if you want.
    – Andrius
    Jan 26, 2013 at 10:19

1 Answer 1

2

Or it could be a circular import? Or you might not have a init.py in the apps` directory?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.