entrepaul
entrepaul

Reputation: 947

Should I move my project files into the parent directory after starting a project in Django?

After I run django-admin.py startproject foobar it creates a parent foobar directory and another foobar (same name) folder within that, along with the manage.py file. The question is - should I move all of the files from /foobar/foobar into /foobar, and just delete the redundant directory? What is the reason this structure is there in the first place?

Upvotes: 4

Views: 716

Answers (2)

Dmitry Shevchenko
Dmitry Shevchenko

Reputation: 32414

The new project layout is there to remove sys.path hackery inside manage.py script and to eliminate nasty bugs with imports that lead to executing some code, like signal handlers, many times instead of one.

Upvotes: 6

Mp0int
Mp0int

Reputation: 18727

From the Documentation:

mysite/
    manage.py
    mysite/
        __init__.py
        settings.py
        urls.py
        wsgi.py
  • The outer mysite/ directory is just a container for your project. Its name doesn't matter to Django; you can rename it to anything you like.
  • manage.py: A command-line utility that lets you interact with this Django project in various ways. You can read all the details about manage.py in django-admin.py and manage.py.
  • The inner mysite/ directory is the actual Python package for your project. Its name is the Python package name you'll need to use to import anything inside it (e.g. import mysite.settings).

Upvotes: 2

Related Questions