0

I just started using Django 1.4 and am facing an issue while executing running syncdb.

  1. Executed the following:

    mynane@mynane:~/djsamplecode$ django-admin.py startproject mysite

    mynane@mynane:~/djsamplecode$ ls mysite

    manage.py mysite mynane@mynane:~/djsamplecode$ cd mysite/

    mynane@mynane:~/djsamplecode/mysite$ ls

    manage.py mysite

    mynane@mynane:~/djsamplecode/mysite$ cd mysite/

    mynane@mynane:~/djsamplecode/mysite/mysite$ ls

    init.py settings.py urls.py wsgi.py

    mynane@mynane:~/djsamplecode/mysite/mysite

    mynane@mynane:~/djsamplecode/mysite$ python manage.py startapp blog

    mynane@mynane:~/djsamplecode/mysite$ ls blog/

    init.py models.py tests.py views.py

As per django 1.4 documentaion this is expected:

Added the name of my appplication 'blog' the settings.py as:

INSTALLED_APPS = (
    'mysite.blog',

Modified the mysite/blog/models.py and executed

python manage.py syncdb and got the following error:

myname@myname:~/djsamplecode/mysite/blog$ python ../manage.py  syncdb
Error: No module named blog

If i modify settings.py as

INSTALLED_APPS = (
    'blog'

it is working fine. Can someme help me understand the directory structure in Django1.4?

futurenext110
  • 1,991
  • 6
  • 26
  • 31

1 Answers1

0

Your apps can be placed anywhere within PYTHONPATH and then you can add appnamame eg blog to your INSTALLED_APPS. Also it is not a bad idea to place your apps outside the project directory (within PYTHONPATH) in order to make them more reusable.

machaku
  • 1,176
  • 8
  • 7