jeudi 7 novembre 2019

Django proper way to save global API client instance variable

How to store some API client instance and make it available across the whole project.

API client instance - is some AppApi() and I need to call it's methods in different views (and even apps) from whole django project.

As for me, there are two ways:

  1. create a global variable in some core django app core/apps.py module;
  2. create singleton wrapper;

What is the best and proper way to do in this case?

Aucun commentaire:

Enregistrer un commentaire