I just finished doing the tutorial django app. I now want to build my own app. Should I just create a new app within the tutorial project folder or should I create a new project folder with a new app?
I am unsure in which cases it makes sense t开发者_运维百科o re-use a project and create multiple apps under that project vs. making new projects for each new app
You don't need to create a project for each app. When you create a project, you can define new apps inside a project if you want, in fact the manage.py
inside the project folder is the same as the django-admin.py
outside. So you can startapp
directly using django-admin.py
:
$ django-admin.py startproject foo
$ django-admin.py startapp bar
$ ls foo bar/
bar/:
__init__.py models.py tests.py views.py
foo:
__init__.py manage.py settings.py urls.py
A website is usually a project. In that website, you may have multiple features (a blog, a wiki, etc.). Each of those features should be an application in the project.
精彩评论