#25748 closed Cleanup/optimization (fixed)
Glossary: Project vs App
Reported by: | Thomas Güttler | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | carsten.fuchs@…, zachborboa@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There are several blog posts and stackoverflow answers about this topic:
"Project" vs "App".
I would like to see an official statements about these terms.
I checked the current docs and could not find a definition. I hope I was not blind :-)
What is an "app" and what is a "project"?
Here is what I tell new team mates:
Project: A project is a container for app. It contains only settings, no database models. Since it contains no database models it does not contain database schema migrations. It can contain migrations which fill a database with project specific data. A project might contain a sitecustomize.py
App: An app has models, views and code. It should be re-usable. An app can depend on an other apps. It must not depend on a project. An app can contain a settings.py for testing, but it has no settings on its own. It should have instructions which settings are needed to get the app running in a project. A app must not contain a sitecustomize.py.
Change History (12)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
I have not found that with before. I added above link to the relevant questions at stackoverflow.
Still I think this part could be improved to be more explicit.
What is wrong with my above definition? Could it be added to the docs?
comment:3 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Cleanup/optimization |
I'm not familiar with sitecustomize.py
so I think that would need to be explained. I'm not sure if it's something that Django needs to discuss or not. Apps aren't necessarily reusable -- some are meant to be reuseable but others aren't. I think the startapp
and startproject
commands give a good idea about what each thing is but feel free to submit a pull request if you'd like to suggest some improvements.
comment:4 by , 9 years ago
Cc: | added |
---|
comment:5 by , 9 years ago
Cc: | added |
---|
comment:6 by , 9 years ago
comment:7 by , 9 years ago
I created a pull request to improve the docs: https://github.com/django/django/pull/5788
comment:12 by , 8 years ago
Just for the records: a virtualenv can't provide a custom sitecustomize.py. This works on some linux distributions, but not on all. Some distributions provide a global sitecustomize. Use usercustomize instead.
There are a few words about this in https://docs.djangoproject.com/en/1.8/ref/applications/#projects-and-applications.