I'm a django newbie and have been having a problem.
In my project root I created a folder called 'local_apps' and within it I put the app 'myapp'. I updated the INSTALLED_APPS within settings.py with: myproject.local_apps.myapp
However when I try to syncbd, Django gives an error: 'no module named local_apps.myapp exists'
When I put 'myapp' back in the project root, it works again but I dont want it that way. I wa开发者_开发百科nt to keep my apps in the folder 'local_apps'.
Can you tell me what I am doing wrong here.
Thanks in advance.
I think that's a generic python error, not a Django error.
Maybe you need to create an __init__.py
file in the local_apps directory, so python knows it's a module.
Do you have a models.py
within the myapp folder? I think Django may need to see that file in the app.
[Edit: actually, I think wisty above may be right, make sure you have an __init__.py
, if you do, try the models.py.]
I was facing the error: ImportError: No module named foo
To solve this, I just added the Django site package to the Python path at settings.py
module like this:
PKG_DIR = os.path.dirname(__file__)
sys.path.append(PKG_DIR)
精彩评论