Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a naming convention for Django apps

People also ask

What is the difference between a Django project vs an app?

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 many apps should a Django project have?

Django comes with six built-in apps that we can examine.

What does app mean in Django?

What is app in Django. An app in Django is a sub-module of a project, and it is used to implement some functionality. Now, you can refer to an app as a standalone python module that is used to provide some functionality to your project. We can create multiple apps within a single Django project.


They must be valid package names. That rules out 2 ("import my-django-app" would be a syntax error). PEP 8 says:

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.


some good examples

  • graphene_django
  • users
  • orders
  • oauth2_provider
  • rest_framework
  • polls

in simple terms, app_name should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. also should have a short name and it can be a plural and singular name


App directory names must be a valid Python package name. This means that option 2 is completely inadmissible as a package name, although it can still be used for other purposes, such as documentation. In the end it comes down to personal style. If you prefer option 3 then use it.