Andrew O'Brian
Andrew O'Brian

Reputation: 41

What is the right way to link up an app in Django?

I'm somewhat a beginner with Django and I'm wondering why people link up apps in settings.py in INSTALLED_APPS in 2 different ways. One is just the name of the application and the other one 'appname.apps.AppnameConfig'.

What is the difference between the two ways?

Upvotes: 1

Views: 37

Answers (1)

Ken Kinder
Ken Kinder

Reputation: 13140

Traditionally, items listed in settings.INSTALLED_APPS are Python packages. Generally if you install a third party package, it's imported more or less directly. For example, if I make a my_django_addon package, I would include it as such, after bundling it as a Python package and installing it with easy_install, pip, etc.

An alternative is to point not to the package itself, but to a Django appconfig. This newer approach doesn't point directly to the Python package itself, but rather, a configuration object with some extra metadata.

Upvotes: 1

Related Questions