2

I've just started a new project in django 1.4 and since they've changed the default layout for manage.py and the whole folder hierarchy (see https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py) i cannot decide where should i put my app packages - inside mysite or outside it? What's the best practice? For some reason, startapp command creates the app outside of the mysite package, but this feels somehow wrong.

So, what's the best? This:

manage.py
mysite/
    __init__.py
    settings.py
    urls.py
    myapp/
        __init__.py
        models.py

or this:

manage.py
myapp/
    __init__.py
    models.py
mysite/
    __init__.py
    settings.py
    urls.py

?

DataGreed
  • 13,245
  • 8
  • 45
  • 64

1 Answers1

1

The second way.

manage.py
myapp/
    __init__.py
    models.py
mysite/
    __init__.py
    settings.py
    urls.py
lciamp
  • 675
  • 1
  • 9
  • 19
  • I guess it's easy to maintain when you have a bunch of apps in one project? That's the way they show you how to set it up in the tutorial. – lciamp Jun 04 '12 at 21:17
  • So, I looked into it, usually when you make an app in django you give it its own urls.py and by setting the structure up like this it makes import statements shorter and more maintainable. – lciamp Jun 05 '12 at 04:52
  • lolwut? What is easy to maintain? I am asking why it's better to store apps higher in django 1.4. Only because of short imports? Then I don't see ANY benefits from doing that, only a mess. – DataGreed Jun 05 '12 at 06:30
  • 1
    lol, I know, i'm not saying I agree with it, it's the only reason I could find. ;) – lciamp Jun 05 '12 at 22:00