All Projects → svetlyak40wt → django-globals

svetlyak40wt / django-globals

Licence: other
Thread specific global variables with middleware to hold a reference to the current user.

Programming Languages

python
139335 projects - #7 most used programming language

Django-globals

changelog

Django-globals is a very simple application, that allow you to define thread specific global variables.

It includes a middleware Global, which can be used to access to the current request and user, which is useful outside of a view when the “request” variable is not defined.

Installation

Install using pip

pip install django-globals

Configuration

In your project’s settings.py, add django_globals.middleware.Global to MIDDLEWARE (or MIDDLEWARE_CLASSES on Django < 1.10).

Usage

Now you can use from django_globals import globals and access to the globals.request and globals.user from anywhere.

Help

For more information see the documentation at:

https://django-globals.readthedocs.io/

If you have questions or have trouble using the app please file a bug report at:

https://github.com/svetlyak40wt/django-globals/issues

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].