TMOTTM
TMOTTM

Reputation: 3391

How are the directories of a Django Project tree referred to?

Assume you have a directory where you keep all your Django projects:

$HOME/Programming/Django_Projects

If you in this directory call

django-admin startproject blog

you'll end up with the following director tree:

$HOME/Programming/Django_Projects/blog
$HOME/Programming/Django_Projects/blog/blog

What's the first blog and whats blog/blog?

Upvotes: 1

Views: 130

Answers (1)

Paolo
Paolo

Reputation: 853

When you use the command:

django-admin startproject blog

The first blog is just a website folder or simply a container for your project. The blog subfolder is the actual project folder which contains the following:

$HOME/Programming/Django_Projects/blog/blog/
    __init__.py
    settings.py
    urls.py
    wsgi.py

Bottom line is, the first blog is simply a container of your django project/files. You can always change its filename and it won't affect anything Django-related.

Also, what you can do is make use of:

django-admin startproject blog .

Notice the . after the name of your project, this will allow you to create a project directly in the current directory without having blog/blog

So, if you do:

$HOME/Programming/Django_Projects> mkdir first_django_project
$HOME/Programming/Django_Projects> cd first_django_project
$HOME/Programming/Django_Projects> django-admin startproject blog .

What you'll get is this project tree:

$HOME/Programming/Django_Projects/first_django_project/
    blog/
        __init__.py
        settings.py
        urls.py
        wsgi.py
    manage.py

Therefore no duplicate/confusing names.

Upvotes: 2

Related Questions