I started to create in Django sample project, first command:
django-admin.py startproject test
gives me:
- root
- test
- __init__.py
- settings.py
- urls.py
- wsgi.py
- manage.py
Now I create first app:
python manage.py startapp foo
it created for me folder root/foo
so how I should understand my root/test folder. Is this folder for global config of my project and nothing more? (similar to Symfony 2 app folder)
I am confused because Django docs tells:
The inner mysite/ directory is the actual Python package for your
project
but manage.py startapp foo create app under root, not under root/test (mysite equivalent)
[EDIT]
Two commands:
python manage.py startapp app
and:
django-admin.py startapp app
gives me app inside project root, not under root/name_of_generated_project
Django 1.4
[EDIT] 2
Sorry guys, my fault, now is everything ok.
[EDIT] 3
I want to create another project again:
django-admin.py startproject jobeet
my initial structure is similar to above.
Now I want to try create app (inside jobeet folder):
django-admin.py startapp jobs
and I end up with jobeet/jobs not jobeet/jobeet/jobs
again :/
so inside my project root I have:
- jobeet
- jobs
- manage.py
another command:
python manage.py startapp app
gives me the same result
So let’s say you create a new Django project
testproject:This creates a new project with the following minimal set of files:
To create a new app for your first site
mysite1go intotestprojectdirectory and run:which results in a new directory
mysite1for themysite1app.I.e. with just these two commands you would arrive at this hierarchy:
Refer to the
django-admin.pyand/ormanage.pyindividual commands here.In Django there is a one-to-many relationship between a
projectand anapp. An app is usually one individual site component (e.g.comments,ratings), whereas a project is an organisation of several apps and can power many different sites. That’s why you get the sites framework. In practice, one project usually serves one website, but with Djangositesapp with one project you can serve as many websites as you like, for reusability’s sake.P.S. I think creating a project simply called
testis not a good practice because with Django unit tests atapplevel unit tests will go into a file calledtests.pyor within a folder calledtests.UPDATE for Django 1.4
As @zeantsoi has commented below, my answer: