Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get ip address in django

request.META.get("REMOTE_ADDR")
Comment

get ip from request django

def get_client_ip(request):
    x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
    if x_forwarded_for:
        ip = x_forwarded_for.split(',')[0]
    else:
        ip = request.META.get('REMOTE_ADDR')
    return ip
 
get_client_ip(request)
Comment

PREVIOUS NEXT
Code Example
Python :: how to print whole year calendar in python 
Python :: typage in python 
Python :: python legend being cut off 
Python :: No default language could be detected for django app 
Python :: set axis ticks matplotlib 
Python :: create random dataframe pandas 
Python :: install python homebrew 
Python :: how to check if a network port is open 
Python :: calculate highest frequency or mode in pandas dataframe 
Python :: reading a csv file in python 
Python :: python append to file 
Python :: square finder python 
Python :: skip header in csv python 
Python :: replace nan in pandas 
Python :: closing text files in python 
Python :: find geomean of a df 
Python :: python Split a file path into root and extension 
Python :: if(guess_password == list(password): 
Python :: python random choice from list 
Python :: upgrade python to 3.9 i linux 
Python :: virtual env in mac 
Python :: how to flip a list backwards in python 
Python :: divide by zero errors when using annotate 
Python :: `12` print () 
Python :: python calling dynamic function on object 
Python :: python make integer into a list 
Python :: how to return only fractional part in python 
Python :: pandas drop extension name from list of files 
Python :: change size of yticks python 
Python :: how to fill an array with consecutive numbers 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =