4

In Djano, why should I add third-party package names inside the INSTALLED_APPS for some packages such as django-filter, DRF, debug-toolbar etc, while I don't want to add for some packages such as Celery, Requests etc ?

I couldn't figure out why should add them to a specific list, even though they all are similar pip packages and I installed them in the same way.
Thanks in advance!

2
  • 2
    Because they are Django apps. Celery and requests are not Django apps, they are separate Python libraries. Commented Mar 25, 2018 at 12:07
  • Kind of re-usable apps ? Commented Mar 25, 2018 at 12:09

2 Answers 2

5

From docs :

Package? App?

A Python package provides a way of grouping related Python code for easy reuse. A package contains one or more files of Python code (also known as “modules”).

A package can be imported with import foo.bar or from foo import bar. For a directory (like polls) to form a package, it must contain a special file init.py, even if this file is empty.

A Django application is just a Python package that is specifically intended for use in a Django project. An application may use common Django conventions, such as having models, tests, urls, and views submodules.

From above statements we understand that every well-written python code could be a package, now if this package is a bunch of python code in a directory, installing it would mean just copy the directory in your project and import them wherever needed in code.

But now there is this package which was already a django app and maybe used some special advantages of being one. Like exposing a restful API or delivering some sort of static resources or even working with special django-specific classes. these kind's of operation's need your direct permission in settings.py so that your project will know how to deal with this package. or even they may require to include their url path's to your project so that people visiting your site could access them.

I assume all this manual job is an act of security.

Sign up to request clarification or add additional context in comments.

Comments

-1

You need to add apps with models(non-abstract), templates, templatetags or management commands so that django-admin finds and loads them

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.