H
H
hey_umbrella2021-11-06 02:31:45
Django
hey_umbrella, 2021-11-06 02:31:45

How to save user's ip when registering in django?

How to make models and views right

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
ge, 2021-11-06
@gedev

The first link on google answers your question.
The web server usually passes information about the client's IP in the REMOTE_ADDR variable, and if there is a proxy server in front, then in HTTP_X_FORWARDED_FOR. It remains only to read the variable. There are already ready-made solutions here: https://stackoverflow.com/questions/4581789
In models, you are already looking at your implementation. I think it will be enough to simply add a new field that will store the received IP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question