Projects vs. apps

34 views
Skip to first unread message

Thufir Hawat

unread,
Jan 16, 2017, 5:59:45 PM1/16/17
to django...@googlegroups.com
Not sure that I follow:

What’s the difference between a project and an app? An app is a Web
application that does something – e.g., a Weblog system, a database of
public records or a simple poll app. A project is a collection of
configuration and apps for a particular website. A project can contain
multiple apps. An app can be in multiple projects.


How can an app be in multiple projects? If someone would make that
sentence more concrete that would be appreciated.


thanks,

Thufir

Mike Dewhirst

unread,
Jan 16, 2017, 6:21:49 PM1/16/17
to django...@googlegroups.com
A Django "app" is just part of a project. A simple project must have at
least one app to contain the models, views and templates. More complex
projects would get unwieldy (code-wise) if you couldn't split them into
multiple apps. Think of these as multiple directories containing
separate sets of models, views templates - but which can connect to each
other by using the ordinary Python "import" mechanism.

Those multiple directories have names equal to the app names. So from
app.models import Classname becomes an easy way of simplifying your
project into multiple directories.. er apps.

In the settings, you need to name all the apps (dirs) in the project so
Django knows where to find all the models and so on.

If you know you will use a particular part of one project (an app - say
for inserting note records into a table) in another project you can
copy/paste and adjust the edge bits so it works in that other project.
On the other hand, if you are disciplined and careful you can use object
oriented programming techniques (and the Django docs) to write those
edge bits in a non-specific way so it can slot unchanged into other
projects which are expecting it. That app can be in multiple projects.

If you are really disciplined and part-guru you can make such apps
public for us lesser mortals to install and save us from re-inventing
that particular wheel. But that's another story :)

Cheers

Mike


>
>
> thanks,
>
> Thufir
>

Antonis Christofides

unread,
Jan 17, 2017, 3:55:41 AM1/17/17
to django...@googlegroups.com
django.contrib.admin is an example of an app. You can use it in multiple
projects by specifying it in INSTALLED_APPS. apps that can be used in multiple
projects are typically pip-installable.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com
Reply all
Reply to author
Forward
0 new messages