Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8070655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:27:21+00:00 2026-06-05T13:27:21+00:00

Django and everything are running on a server. When a user from his/her local

  • 0

Django and everything are running on a server. When a user from his/her local machine accesses the application, I need to save the IPV4 and IPV6 from this local machine into a form.

This is the view I’m using to save data:

def t031003form_save(request):
    form = T031003Form(request.POST or None, request.FILES or None)
    if request.method == 'POST':
        if form.is_valid():
            form = form.save(False)
            form.C003LOGB = datetime.date.today()
            form.C003LOGD = socket.gethostbyname(socket.gethostname())
            form.save()
            form = T031003Form()
        else:
           return HttpResponseRedirect('/erro/')
    return render_to_response('T031003Form_save.html', {'form': form,}, context_instance=RequestContext(request))

But with this view I’m not sure if the field I’m using to save the IPV4 is picking only the IPV4 address from where Django is running, which is the server. I guess it won’t pick the IPV4 address from the local machine that I need.

Many thanks in advance from any help you can give to me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:27:22+00:00Added an answer on June 5, 2026 at 1:27 pm

    You can only get the IP address the user used to access your site, i.e. the IPv4 or the IPv6 but not both. The current IP address is available via request.META['REMOTE_ADDR']

    However, there is a rather easy way to get both:

    • Create two subdomains, v4.yourdomain.tld and v6.yourdomain.tld which are only reachable via IPv4/6.
    • On your actual page, generate a random token that is associated with the user and create a script tag:

      <script src="//vX.yourdomain.tld/?token=YYY"></script>
      

      If the user accessed your page via IPv4, use X=6, otherwise X=4.

    • In your code that runs when accessing one of the subdomains, log the IP for the user identified by the token.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a django server running on my local machine that I want
I'm publishing a feed from a Django application. I subclassed django.contrib.syndication.feeds.Feed, everything works fine,
I'm getting some really weird issues with the Django admin application. I'm running everything
I'm running fabric (Django deployment to apache) and everything seems to work fine until
Everything works as supposed to on the Django development server. In Apache, the django
I am trying to get my Django project running on the production server. I
I'm running a django app through fcgi on my school's shared hosting system. Everything
I'm making a threaded forum app using django-mptt. Everything is up and running, but
I just set up Django on a dreamhost server. Ran through everything, but can't
I have my Django site up and running, and everything works fine EXCEPT: When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.