0

I have a Django Website and I'm using IPInfo. When the user signs up, I have the following signal:

@receiver(user_signed_up)
def create_profile(request, user, **kwargs):
    ip = request.ipinfo.ip
    city = request.ipinfo.city
    country = request.ipinfo.country
    region = request.ipinfo.region
    timezone = request.ipinfo.timezone
    postal = request.ipinfo.postal
    loc = request.ipinfo.loc
    //Save into DB

However, instead of saving the user's details it saves the server's IP, city, etc. What am I doing wrong and how can I fix this?

user2896120
  • 3,180
  • 4
  • 40
  • 100
  • What signal is this function listening to? The request is not usually passed to any of the pre/post save signals – Iain Shelvington Jan 24 '21 at 07:16
  • 1
    The request IP will be the IP of your front-end reverse proxy. You need to look at how the reverse proxies are configured to find out if they add an attribute to the request header with the *actual* request IP, in it; see https://stackoverflow.com/questions/4581789/how-do-i-get-user-ip-address-in-django – Stephen C Jan 24 '21 at 07:16
  • @IainShelvington I just updated the question. It is the `AllAuth` User Sign up signal – user2896120 Jan 24 '21 at 07:18

0 Answers0