S
S
Stepan Sidorov2020-02-13 09:11:59
Django
Stepan Sidorov, 2020-02-13 09:11:59

How to make a global, immutable variable in Django?

I need a variable in Django that stays the same until the user logs out of the site.
That is: I once declared a variable, and even after reloading the site, even after switching to another page, it should have the value that I assigned to it at the very beginning.
I need this for:
So that after the user registers, he does not register again when the site is reloaded, and when he goes to the next page, he remains registered or logged in.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Kitaev, 2020-02-13
@Stepan47

Set a cookie. If they cannot be changed by the user, set signed cookies

D
Dr. Bacon, 2020-02-13
@bacon

If you don't understand how django works, follow the tutorial from off site or from django girls

S
Sergey Gornostaev, 2020-02-13
@sergey-gornostaev

The Soviet state issued the Volga to the honorary reindeer herder. After some time, the journalists decided to find out the opinion of the Chukchi about the award. "Good car." - the Chukchi answers - "It's warm in the cabin, the headlights illuminate the tundra. Only dogs get tired quickly, however."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question