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?
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.
From the Documentation:
mysite/
manage.py
mysite/
__init__.py
settings.py
urls.py
wsgi.py
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.p
y and manage.py
.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
).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With