2

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 want to keep my apps in the folder 'local_apps'.

Can you tell me what I am doing wrong here.

Thanks in advance.

user639998
  • 23
  • 1
  • 4

3 Answers3

2

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.

wisty
  • 6,981
  • 1
  • 30
  • 29
  • Wow that was fast. Thanks wisty, that worked. The syncdb works now. @dappawit, the models.py is present and is now being updated as it should. Thanks again guys – user639998 Mar 01 '11 at 20:04
0

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)
Caumons
  • 9,341
  • 14
  • 68
  • 82
0

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

dappawit
  • 12,182
  • 2
  • 32
  • 26
  • Wow that was fast. Thanks wisty, that worked. The syncdb works now. @dappawit, the models.py is present and is now being updated as it should. Thanks again guys – user639998 Mar 01 '11 at 20:01
  • sorry, double reply. As you can see, I'm new to Stackoverflow aswell. – user639998 Mar 01 '11 at 20:05