Should I move project files to the parent directory after starting the project in Django?

After running django-admin.py startproject foobar it creates the parent directory foobar and another foobar (of the same name) folder inside this file along with the manage.py file. The question is, should I move all files from /foobar/foobar to /foobar and just delete the backup directory? What is the reason for this structure in the first place?

+4
source share
2 answers

The new project layout allows you to remove the sys.path-hacking inside the manage.py script and eliminate unpleasant import errors that lead to the execution of some code, for example, signal handlers, many times instead of one.

+6
source

From the documentation :

 mysite/ manage.py mysite/ __init__.py settings.py urls.py wsgi.py 
  • External mysite/ is just a container for your project. His name does not matter to Django; You can rename it to whatever you like.
  • manage.py : a command line utility that allows you to 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 .
  • The mysite/ internal directory is a real Python package for your project. Its name is the name of the Python package that you need to use to import something inside it (e.g. import mysite.settings ).
+2
source

Source: https://habr.com/ru/post/1433483/


All Articles