Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django StaticLiveServerTestCase does not show data in grouped test
I am writing functional tests using Selenium for an app written in Django 1.9. I have a function populate_test_db() that creates some test data using factory_boy: def populate_test_db(self): """ Adds records to an empty test database """ self.coder = UserFactory.create() self.country = CountryFactory.create() self.assignment = AssignmentFactory.create() self.assignment_progress = AssignmentProgressFactory.create(assignment = self.assignment) self.article = ArticleFactory.create(assignments = (self.assignment,)) self.articles = ArticleFactory.create_batch(100, assignments = (self.assignment,)) return self I call this function when setting up the functional tests for my app like this: from functional_tests.testing_utilities import populate_test_db class NewUserTest(StaticLiveServerTestCase): def setUp(self): self.browser = webdriver.Chrome() populate_test_db(self) (I also have tried using setUpTestData() but that doesn't seem to work either with StaticLiveServerTestCase). I then run the two following tests: def test_can_login_to_site(self): self.browser.get(self.live_server_url) username = self.browser.find_element_by_css_selector('#login_form > table > tbody > tr:nth-child(1) > td:nth-child(2) > input[type="text"]') username.send_keys('bobby') password = self.browser.find_element_by_css_selector('#login_form > table > tbody > tr:nth-child(2) > td:nth-child(2) > input[type="password"]') password.send_keys('very_secure') password.send_keys(Keys.ENTER) time.sleep(1) assignment = self.browser.find_element_by_css_selector('#assignments > table > tbody > tr:nth-child(2) > td:nth-child(1) > a') self.assertIn(self.assignment.country.state_name, assignment.text) def test_can_access_assignment(self): print(self.coder) print(self.assignment) self.browser.get(self.live_server_url) username = self.browser.find_element_by_css_selector('#login_form > table > tbody > tr:nth-child(1) > td:nth-child(2) > input[type="text"]') username.send_keys('bobby') password = self.browser.find_element_by_css_selector('#login_form > table > tbody > tr:nth-child(2) > td:nth-child(2) > input[type="password"]') password.send_keys('very_secure') password.send_keys(Keys.ENTER) time.sleep(1) assignment = self.browser.find_element_by_css_selector('#assignments > … -
How do I add an extra field in Django Admin?
I'm just starting out with Django and I've just revamped my project so that instead of using the base user, I use an AbstractUser model, as defined in my models.py folder #accounts/models.py from django.contrib.auth.models import AbstractUser from django.db import models class CustomUser(AbstractUser): # add additional fields in here favourite_colour = models.CharField("Favourite Colour", max_length=100) def __str__(self): return self.email I've also created the creation forms that work well with my signup system #accounts/forms.py from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.contrib.auth.models import User from django import forms from .models import CustomUser class CustomUserCreationForm(UserCreationForm): class Meta(UserCreationForm.Meta): model = CustomUser fields = ('username', 'email', 'favourite_colour') help_texts = { 'username': 'Make something unique', 'email': None, } class CustomUserChangeForm(UserChangeForm): class Meta: model = CustomUser fields = ('username', 'email', 'favourite_colour') And now I am trying to edit the admin page so that I can change a users favourite_colour attribute. So far I have this in my admin.py file #accounts/admin.py from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .forms import CustomUserCreationForm, CustomUserChangeForm from .models import CustomUser class CustomUserAdmin(UserAdmin): add_form = CustomUserCreationForm form = CustomUserChangeForm model = CustomUser list_display = ['username', 'email', 'favourite_colour'] admin.site.register(CustomUser, CustomUserAdmin) Which shows me the favourite_colour of each user My question is, how do I … -
Unexceptional behaviour of my django application image hosting on AWS?
I have developed an application in Django. There is a report form with an image field. My problem is that some images upload and show in the feed page successfully while some images giving this error: 2018/08/20 19:34:37 [error] 4498#4498: *89 open() "/home/ubuntu/media/153476127499997915256.jpg" failed (13: Permission denied), client: 103.201. The images which are upload and show in feed and admin are: 1. http://backmyitem.com/media/JPEG_example_JPG_RIP_100.jpg 2. http://backmyitem.com/media/IMG_20180720_155801.jpg 3. http://backmyitem.com/media/download.jpeg 4. http://backmyitem.com/media/unnamed.png Images which are showing error are the following : http://backmyitem.com/media/IMG_20180818_131444.jpg http://backmyitem.com/media/IMG_20180819_233440.jpg http://backmyitem.com/media/IMG_20180820_015329_OepNBu3.jpg Is there any who can identify this unexceptional behavior. My application is running on AWS and using Nginx server. -
Testing Multiple inheritance CBV in Django leads to redundant tests
I have a base view that is defined as following: class EditProfileMixin(LoginRequiredMixin, UpdateView): def get_object(self, *args, **kwargs): return self.request.user I am inheriting from this view for any action that requires user to be logged in to update any private information ( contact details etc.), and test those views for the same functionality ( user is logged in and get_object returns the right information. however , I feel that I am doing it wrong because the tests seems redundant to me ... what is the right way of testing this kind of inheritance ? -
Setup redirect URL with correct port for django-allauth
I tried to follow the tutorial at https://wsvincent.com/django-allauth-tutorial-custom-user-model/ My authorized desired callback URL is https://localhost:2053/accounts/google/login/callback/ Under Site, I fill up as follow I have the following code in settings.py # DJANGO-ALLAUTH SETTINGS # Site id required for using 'sites' framework with django-allauth SITE_ID = 2 # 2 is for localhost:2053 Then, I try to login to Google by clicking on the following link <p><a href="{% provider_login_url 'google' %}">Log In with Gmail</a></p> However, I get the following error from Google It seems that django-allauth is passing the wrong redirect URL without correct port (http://localhost/accounts/google/login/callback/). The correct URL should be https://localhost:2053/accounts/google/login/callback/ But django-allauth is passing http://localhost/accounts/google/login/callback/ May I know how I can pass the correct redirect URL to Google? -
Django - Update a record using a modelform (Table contains Unique_constraint)
The idea would be that the user should be able to go in and update the record using the same form I have provided. I included a unique constraint because the idea was that a Requisition can contain multiple Requisition_lines. For the initial phase I have hard coded sequence=1. It saved the record initially but I am now getting an Integrity error when i try to update the record using update_or_create. Any help would be appreciated! Let me know if any more information is needed. Models.py class Requisition(models.Model): username = models.ForeignKey( 'users.CustomUser', on_delete=models.CASCADE, related_name='req_user') signature = models.CharField(max_length=10, blank=True, null=True) status = models.ForeignKey('RequisitionStatus', related_name='req_status', on_delete=models.CASCADE) class RequisitionLine(models.Model): parent_req = models.ForeignKey('Requisition', on_delete=models.CASCADE, related_name='par_req_line' ) sequence = models.PositiveIntegerField() item_code = models.ForeignKey( 'items.ItemMaster', on_delete=models.CASCADE, related_name='req_item', blank=True, null=True) description = models.CharField(max_length=50, blank=True) extra_information = models.TextField(blank=True) quantity = models.PositiveIntegerField(blank=True, default=0,null=True) price = models.DecimalField(max_digits=19, decimal_places=2, blank=True, default=0.00,null=True) purchase_order = models.CharField(max_length=9, blank=True,null=True) po_line = models.PositiveSmallIntegerField(blank=True,null=True) req_delivery_date = models.DateField(blank=True,null=True) act_delivar_date = models.DateField(blank=True, null=True) class Meta: unique_together = ('parent_req','sequence') Views.py def update_requisition(request, id): current_req = Requisition.objects.get(id=id) if current_req.username == request.user: data = { 'parent_req': id } if request.method == "POST": req_form = ReqForm(request.POST, instance = current_req) if req_form.is_valid(): req_form_line, created = RequisitionLine.objects.update_or_create( parent_req = current_req, sequence = 1, description = … -
Django CMS Reverse accessor for 'PageUser.user_ptr' clashes with reverse accessor for 'PageUser.user_ptr'
I've been working to get Django CMS integrated into our existing app. Yesterday I ran into this: Django CMS FieldError: Local field 'created_by' in class 'PageUser' clashes with field of similar name from base class 'User' Our solution is to fork django-cms and do as suggested, rename created_by to page_user_created_by. Now, I'm getting this error: django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues: ERRORS: cms.PageUser.user_ptr: (fields.E304) Reverse accessor for 'PageUser.user_ptr' clashes with reverse accessor for 'PageUser.user_ptr'. HINT: Add or change a related_name argument to the definition for 'PageUser.user_ptr' or 'PageUser.user_ptr'. cms.PageUser.user_ptr: (fields.E305) Reverse query name for 'PageUser.user_ptr' clashes with reverse query name for 'PageUser.user_ptr'. HINT: Add or change a related_name argument to the definition for 'PageUser.user_ptr' or 'PageUser.user_ptr'. I'm not sure where or how to add a related_name to the PageUser.user_ptr. I've changed the related_name on the page_user_created_by field, but that did nothing. Does anyone have an idea of where I can look to fix this clash? I'm on django 1.9 and working on the 3.4.x branch of the forked django-cms. -
Django Detailview Error Handling
I have a scenario where I am trying to send different messages to the user in the event that they are not authorized to see a record or if the record does not exist. I have been able to get the interface to send a message to the user if a 404 occurs, but can't quite figure out the logic based on criteria of the record. I've been playing with get, get_object, or get_object_or_404 and nothing quite works. Here is my DetailView.. class BookSearchDetailView(LoginRequiredMixin,DetailView): model = Book context_object_name = 'book_detail' template_name = 'book/book_search_detail.html' def get_object(self, queryset=None): return get_object_or_404(Book, book_number=self.request.GET.get("q")) def get(self, request, *args, **kwargs): book_number=self.request.GET.get("q") try: self.object = self.get_object() except Http404: messages.add_message(self.request, messages.INFO, 'Book Number %s Not Found' % book_number ) return HttpResponseRedirect(reverse('Book:book_number_search')) context = self.get_context_data(object=self.object) return self.render_to_response(context) Here is my model. class Book(models.Model): book_name = models.CharField(max_length=80,null=True,unique=False) book_number = models.IntegerField(editable=True,null=True) Note I do not have a slug defined to my model. In the current code above, this doesn't cause any problems. When I have played with different code variations, one of the error messages I get is that DetailView must be called with a pk or a slug. I am ultimately trying to filter the book so that if the … -
Lookup django model using two or more different keys
First time developing a django application, and am trying to do something somewhat non-standard... Is there a way to configure a view that will allow a user to look up a certain model by either one of two unique model attributes. Ideally, both of these URL schemes would be possible urlpatterns = [ path('api/somemodel/<int:model_id>/', views.SomeModelDetailView.as_view()) path('api/somemodel/<str:model_name>/', views.SomeModelDetailView.as_view()) ] A simplified example model... Both the id and the name are guaranteed to be unique from django.db import models class SomeModel(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=100, unique=True) Currently, I have this working with the following view... from rest_framework import generics from rest_framework import status from rest_framework.response import Response from . import models class SomeModelDetailView(generics.RetrieveAPIView): queryset = models.SomeModel.objects.all() serializer_class = serializers.SomeModelSerializer def get(self, request, model_name=None, model_id=None, format=None): field = None key = None try: if model_id: field = "model_id" key = model_id m = models.SomeModel.objects.get(id=model_id) elif model_name: field = "model_name" key = model_name m = models.SomeModel.objects.get(name=model_name) else: return Response("Neither model_id nor model_name were provided", status=status.HTTP_400_BAD_REQUEST) except models.SomeModel.DoesNotExist: return Response("Unknown {field}: {key}".format(field=field, key=key), status=status.HTTP_400_BAD_REQUEST) serializer_class = self.get_serializer_class() serializer = serializer_class(m) return Response(serializer.data) However, I am wondering if there is a better way that fits more into a ViewSet/Router (or other) DRF mechanic. Any … -
TypeError while running tests.py
Very new to Django and I'm currently having an issue with a test I'm running on Django. When I use the shell to create instances to return the str it seems to be return it fine but I'm not sure why it doesn't seem to pass the assertIn test and returns a TypeError: expected string or bytes-like object This is my model class Song(models.Model): title = models.CharField(max_length=255) artist = models.CharField(max_length=255) duration = models.TimeField() performer = models.ForeignKey( Performer, on_delete=models.CASCADE, ) def __str__(self): return '%s by %s' % (self.title, self.artist) and this is my test class SongModelTests(TestCase): def setUp(self): self.performer = Performer.objects.create(name='Andrew Chalkley') def test_song_string(self): '''String version of Song should contain the title and artist''' song = Song.objects.create( title="Don't Stop Believing", artist="Journey", duration=250, performer=self.performer) self.assertIn(song.title, str(song)) self.assertIn(song.artist, str(song)) -
Django development server hangs and suddenly does all requests on CTRL+C
I am using django for a REST API at my company and have a few people using the first small part of my app via a Samsung tablet. They connect via WiFi to a angular front-end on Apache, that makes API requests to my django development server. But every now and again the server just freezes intermittently. The front end would work and you can navigate it, but no API calls are going through. And then when ever I press CTRL+C on the development server console, suddenly all the request go through. Depending on how long someone have struggle, there may be 20 API requests that all go through. At these moments even when I change something in Django in vs-code, nothing happens server side, but when I press CTRL+C suddenly even ALL the server restarts also go through. So I can see that all the request are standing in line just waiting for the server to wake up and then they are all processed. It also looks to me if this mostly happens with the tablet (and not my desktop), where we are using Chrome. I read that the server is now multi threaded, so that can not be … -
How to transfer data in django from sqlite to mysql, so that all the data that is in the admin are preserved?
How to transfer data in django from sqlite to mysql, so that all the data that is in the admin are preserved? I have a database with the same tables, where I can transfer all the data. I tried to do it the standard way throughpython manage.py loaddata datadump.json. The data in the tables was transferred but the admin panel got stuck. I use wagtail django admin -
PostgreSQL full text search building GIN index
I am trying to do full text search in a column rss (django text field) of a table named nsviews_aptdisplayrow. It is very slow because rss is very long. So I want to add a GIN index to rss. I can't find a way to add index in django so I do it like this in PostgreSQL directly. CREATE INDEX "rss_vector" ON "nsviews_aptdisplayrow" USING gin(to_tsvector('english', 'rss')); I seach in rss like this: vector = SearchVector('rss') qs = qs.annotate(search=vector).filter(search=finalquery) Actually I didn't see any improvement in speed. Do you know the reason? Is there any wrong what I did? Thanks! -
Visual Studio cl.exe error in installing rpy2
I am installing rpy2 in Django and got the following errors. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I.\rpy\rinterface "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\include" /Tc.\rpy\rinterface\r_utils.c /Fobuild\temp.win-amd64-3.6\.\rpy\rinterface\r_utils.obj r_utils.c .\rpy\rinterface\r_utils.c(23): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2 Tried many solutions available in internet but none worked for me also attaching my Visual studio installations list -
Django: Get_success_url does not redirect
I have a form view that performs some logic within the form_valid method before the user should be redirected to the success_url. However right now, a 302 error is returned and the user does not get redirected. Any ideas? The 302: [21/Aug/2018 17:35:40] "POST /images/pixie/082adb2d-70e3-4d46-a2cc-ad67187efcc8/ HTTP/1.1" 302 - The View: class EditImageForDetailView(SetHeadlineMixin, LoginRequiredMixin, FormView): model = Image image = None form_class = PixieForm headline = "Edit Image" success_message = "Image Added" template_name = "images/pixie.html" def form_valid(self, form): # A bunch of logic setting self.image return super(EditImageForDetailView, self).form_valid(form) def get_success_url(self): return reverse('details:detail_create', kwargs={'uuid': self.image.uuid}) Just to note, get_success_url() references self.image. That is being set within the form_valid() so that isn't the issue. -
Using the django-auth-ldap LDAPSearch to search two OUs
I have an containerized application that is using django-auth-ldap to search an Active Directory for users. I would like to combine the output from two separate OUs. Is there a different method or overload that could take two DN's or a way to the join the output of two separate searches? AUTH_LDAP_USER_SEARCH = LDAPSearch(os.environ.get('AUTH_LDAP_USER_SEARCH_BASEDN', ''), ldap.SCOPE_SUBTREE, "(sAMAccountName=%(user)s)") -
How to extract numerical value from Django queryset?
I feel like this is a very simple/stupid question, but for the life of me I can't figure it out. I'm trying to pull an integer out of a queryset so I can use it with a mathematical operator. All I can get is the queryset but not the actual number... #models.py class Contract(models.Model): contract_number = models.IntegerField(help_text="This is an auto-calculated value for the sequential number of the contract associated with the account (chronological).", null=True, blank=True) account = models.ForeignKey(Account, on_delete=models.CASCADE) >>> Contract.objects.filter(account="xyz").values_list('contract_number', flat=True) <QuerySet [1]> >>>Contract.objects.filter(account="xyz").values_list('contract_number', flat=True) + 1 Traceback (most recent call last): File "<input>", line 1, in <module> TypeError: unsupported operand type(s) for +: 'QuerySet' and 'int'` How do I get the actual number out of the queryset so I can use it? -
Django Forms - Change widget attributes
I want to define a class attribute for the <option/> tags within a django ChoiceField, how can I do that? I tried to set the widget class, and specifying an attribute like so, in forms.py: field = forms.ChoiceField(choices=[(1, 'foo'), (2, 'bar')], widget=forms.Select(attrs={'class': 'form-control'})) And rendering inside my template.html like this: {{ form.field }} The output is: <select name="field" class="form-control" id="id_fields"> <option value="1">foo</option> <option value="2">bar</option> </select> And what I want to have is this: <select name="field" class="form-control" id="id_fields"> <option class="form-control" value="1">foo</option> <option class="form-control" value="2">bar</option> </select> What is the easiest way to do this? -
Django create multiple database for each user under one app
I am trying to create an app, where in which on creating a user it should create a new database for each user and user details has to insert in that database. All databases has the same structure. -
Is it possible use webviews outside of FB Messenger?
I'm developing a bot with Dialogflow and Django, and we need something like the webviews on FB Messenger, but we're not goint to use FB for anything. This is an external bot for a website. Is it possible replicate it or there is something similar out there? I have been searching about it but the only webviws I found are from Facebook. -
Django AJAX link not entering corresponding view
I want users to have the possibility of hiding their posts from the public listing or making it visible once again. My idea was to just have a link that when clicked would change the text and also change the status of a post. Right now the text changes, but the status of the post doesn't, and "I'm here" isn't printed. This is the view: @login_required def change_status(request): print("I'm here") if request.method == 'GET': post_id = request.GET['post_id'] post = Post.objects.get(pk=post_id) if request.user.profile.post == post: if post.status == 'published': post.status = 'hidden' else: post.status = 'published' post.save() return HttpResponse("Success!") else: return HttpResponse("Request not from author") else: return HttpResponse("Request method is not a GET") The url: url(r'^status/$', views.change_status, name='change_status'), The template: {% extends "base_generic.html" %} {% block content %} <h1>{{ post.title }}</h1> <p> {{ post.author }} - {{ post.pub_date }}</p> {% for tag in post.tags.all %} <a href="{% url 'fortykwords:tag' tag.name %}">{{ tag.name }}</a> {% endfor %} <p>{{ post.body }}</p> {% if post.author != request.user %} <a href="{% url "pinax_messages:message_user_create" user_id=post.author.id %}" class="btn btn-default">Message this user</a> {% endif %} {% if post.author == request.user %} {% if post.status == 'published' %} <a class="likebutton" id="like{{post.id}}" href="#" data-catid="{{ post.id }}">Hide post</a> {% endif %} … -
django form drop-down choices are displayed "objects" instead of display value __str__
In my django form I am using a method to filter the drop down options to the ones that are related to the logged-in user. After the implementation the displayed values changed to objects rather than the __str__ value. I am posting the simplified codes and a snapshot that shows this. I have followed everything needed, but I cannot figure out why this is happening: models.py class Business(models.Model): client=models.ForeignKey('Client',on_delete=models.CASCADE, limit_choices_to={'is_active':True},) name=models.CharField(max_length=30,blank=False, unique=True,) def __str__(self): return self.name class MMRequestAttributes(models.Model): client=models.ForeignKey('Client',on_delete=models.CASCADE, limit_choices_to={'is_active':True},) business=models.ForeignKey('Business', on_delete=models.CASCADE,limit_choices_to={'is_active':True},) class Ticket(MMRequestAttributes): no=models.CharField('Ticket Number',max_length=50,default=uuid.uuid4,null=False, blank=False, editable=False, unique=True) subject=models.CharField('Subject',max_length=100,null=False, blank=False) description=models.TextField('Description',max_length=500,null=True,blank=True) created_at=models.DateTimeField('Created at',auto_now_add=True, editable=False) updated_at=models.DateTimeField('Updated at',auto_now=True, editable=False) created_by= models.ForeignKey(settings.AUTH_USER_MODEL) status=StateField(editable=False) def __str__(self): return 'Ticket #' + str(self.pk) views.py def new_ticket(request): form=NewTicket(request.user) return render(request,'mmrapp/new_ticket.html',{'form':form}) admin.py class UserExtend(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, blank=False,null=False,) client=models.ForeignKey('Client', on_delete=models.CASCADE,limit_choices_to={'is_active': True},) forms.py from django import forms from .models import Ticket, Business from .admin import UserExtend from django.forms import ModelChoiceField class NewTicket(forms.ModelForm): def __init__(self,user, *args, **kwargs): super(NewTicket, self).__init__(*args, **kwargs) try: client_id = UserExtend.objects.values_list('client_id', flat=True).get(user=user) self.fields['business'].queryset=Business.objects.filter(client__id=client_id) except UserExtend.DoesNotExist: ### there is not userextend corresponding to this user, do what you want pass class Meta: model=Ticket fields = ('subject','business') new-ticket.html {% extends 'mmrapp/__l_single_column.html' %} {% load static %} {% block main_col %} <h1>New Ticket</h1> <form method="POST" class="new-ticket">{% csrf_token %} … -
Django server works, Apache doesn't
I'm running Django with Python 3.6.1 on Ubuntu 14.04 and Apache 2.4.7 and using mod_wsgi 4.4.12 compiled with Python 3.6.1. If I start the Django server independently of my app and go to 127.0.1.1:8000, my app shows up just fine. If I let my app start the Django server, it looks like it starts -- no errors and my management GUI gets some feedback (shows the Python version) but going to the same URL gets me a web page showing the Apache HTML folder. If I switch to using Apache, I get the web page showing the Apache HTML folder. With Apache, 127.0.1.1 gives "Unable to connect" and 127.0.0.1 gives the default Apache Ubuntu page. The Apache log is not giving any errors. The bottom of my /etc/apache2/apache2.conf file has: ServerName localhost WSGIApplicationGroup %{GLOBAL} WSGIPythonPath /home/user/myproject/myprojectenv/myproject The /etc/apache2/sites-available/000-default.conf file has: Alias /static /home/user/myproject/myproject_static <Directory /home/user/myproject/myproject_static> Require all granted </Directory> <Directory /home/user/myproject/myprojectenv/myproject> <Files wsgi.py> Require all granted </Files> </Directory> WSGIDaemonProcess myproject python-home=/home/user/myproject/myprojectenv python-path=/home/user/myproject WSGIProcessGroup myproject WSGIScriptAlias / /home/user/myproject/myprojectenv/myproject/myproject/wsgi.py The VirtualHost is set to *:8000. Any ideas? -
Python/Django-Sorting locations on map based on time taken to travel from origin
I want to implement something like Zomato/Swiggy. I have many users and there are many restaurants in the locality of every user. I want to present to users the list of restaurants to which he can reach within certain given time(t minutes) arranged from least time to maximum time. So far, I understand that I need to use Google's Distance Matrix API. -
Djano Windows Authentication on Development Server
I am developing a django web app on windows server 2016 in which I am using Windows Authentication, but when I am using on prodcution - request.META['REMOTE_USER'] it was working fine but when I am using the same code on development environment it was giving Key error, even I have checked as well but didn't found REMOTE_USER anywhere. Thanks in advance. Please provide the solution