Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project Name vs Application Name in Django

Tags:

I'm trying to create a new Django/Python project in the JetBrains PyCharm IDE. However, while typing my software name it informs me that

"You cannot call your app the same as your project".

Trying to fully understand the distinction between projects and applications in Django, I'd love someone to demonstrate the difference between an application and a project for some known compounded websites like Facebook, Gmail and YouTube.

like image 256
Reflection Avatar asked Oct 19 '13 19:10

Reflection


People also ask

What is the difference between a project and an app in Django?

A project refers to the entire application and all its parts. An app refers to a submodule of the project. It's self-sufficient and not intertwined with the other apps in the project such that, in theory, you could pick it up and plop it down into another project without any modification.

How do you name a Django app and project?

Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged. So, 1 and 3 are both valid, but 3 would be the recommended approach.

What is my app name Django?

An app name is just the name of the Python module. Nothing more. A python module name is the case name of the root folder of the module, that must contains an init.py file. If you want to know what this name is, go to your site-packages folder and look for your module.

What should be an app in Django?

A Django app is a small library representing a discrete part of a larger project. For example, our blog web application might have an app for posts , one for static pages like an About page called pages , and another app called payments to charge logged-in subscribers.


1 Answers

My try with Facebook:

facebook   users   messages   notifications   posts   ... 

Basically the gist is that an app represents a specific part of your whole project. Moreover, the app can be "pluggable" into a similar project. In order to be maintainable an app should have it's own objectives that differ from the objectives of other apps.

In the excellent "Two Scoops of Django" book, the authors quote James Bennett:

The art of creating and maintaining a good Django app is that it should follow the truncated Unix philosophy according to Douglas McIlroy: "Write programs that do one thing and do it well".

Again the authors state:

In essence, each app should be tightly focused on its task. If an app can’t be explained in a single sentence of moderate length, or you need to say ‘and’ more than once, it probably means the app is too big and should be broken up.

Update 19/12/2014:

With Django 1.7 this description of "Projects and applications" is definitely worth reading.

Update 21/12/2017:

Django 1.10 link here.

like image 179
Joseph Victor Zammit Avatar answered Oct 14 '22 08:10

Joseph Victor Zammit