Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
- 
        Django why request.method=='GET' when refreshing the pageI want to have some search boxes on my page and my related codes are like below, my problem is why when i refresh the page the if clause: " if request.method=='GET':" executes without i click on any button ? def allstocks_view(request): if request.method=='GET': question_set =Stocks.objects.all().filter(confirm=_('approved') ) name=request.GET.get('namesearch') number=request.GET.get('numbersearch') brand=request.GET.get('brandsearch') if name is not None : question_set = question_set.filter(name__icontains = name) if number is not None : question_set = question_set.filter(number__icontains = number) if request.GET.get("brandsearch"): question_set = question_set.filter(brand__icontains = brand) print(">>>>>>>>>>>>>>>>>>>>") print(question_set) template : <form method="get"> {% csrf_token %} <div class=""> <label for="namesearch">Name</label> <input type="text" name="namesearch" > <label for="numbersearch"> Number</label> <input type="text" name="numbersearch" > <label for="brandsearch"> Brand</label> <input type="text" name="brandsearch" > <label for="brandsearch"> City</label> <input type="text" name="citysearch" > <input type="submit" name="search" value="Search"> </div> </form>
- 
        Querying all objects including soft deleted ones of a SoftDeletableModelI'm try to get rid of home-brew solution to favor more standard ones. My previous pattern: class MarkDeleteManager(models.Manager): use_for_related_fields = True def get_queryset(self): if "instance" in self._hints: return super(MarkDeleteManager, self).get_queryset() return super(MarkDeleteManager, self).get_queryset().filter(deleted=False) def all_with_deleted(self): return super(MarkDeleteManager, self).get_queryset() def deleted_set(self): return super(MarkDeleteManager, self).get_queryset().filter(deleted=True) def using(self, *args, **kwargs): ''' if a specific record was requested, return it even if it's deleted ''' return self.all_with_deleted().using(*args, **kwargs) I'd like to replace this with django-model-util's SoftDeletableModel but I don't see any all_with_deleted like functionality in the SoftDeletableManagerMixin - it only overrides get_queryset and that's it. My architecture is decentralized, and when I notify other nodes about soft deletions I need to access those.
- 
        python django filter linksI am trying filter the links and sometimes i get this error. Object of type QuerySet is not JSON serializable I am trying to avoid to serialize the object...because it's not going to be arranged correctly. Hope you see what i mean. This is part of my views.py results_data = [] result_dates = [] for alert in pages_qs.object_list: domain = Crawlerdomains.objects.get(pk=alert.domain_id) CrwlPage = get_page_model(domain.tablename) try: q = request.GET.get('q', None) if q: pg_link = CrwlPage.objects.filter(links__icontains=str(q)) else: pg_link = CrwlPage.objects.get(pk=alert.crwlpgid).links except CrwlPage.DoesNotExist: pg_link = '' alert_dict = { 'id_dmn': alert.domain_id, 'id': alert.pk, 'CrwlPgID': alert.crwlpgid, 'pg_link': pg_link, 'New_CronHistID': alert.new_cronhistid, 'Old_CronHistID': alert.old_cronhistid, 'Website': alert.website, 'LastCrwlDate': str(alert.lastcrwldate), 'PrevCrwlDate': str(alert.prevcrwldate), } results_data.append(alert_dict) and this is how i call it in urls.py urlpatterns = [ url(r'^alert/report/$', views.get_alerts, name='report'), ] basically if i m going to serialize it i m going to have json obj in json... i am trying to extract the links when i q for links. https://example.com/alert/report/?q=word I have tried a lot of things...this is the last thing i have tried. Basically using alert.id i want to check the link of that specific id for the word (Example the word: europe ) and if found....return the link in that json object...else return empty...and if no …
- 
        Python | Docker | Django | django.core.exceptions.ImproperlyConfigured ErrorI'm trying to run a python file that is inside a container however I'm getting the following exception: Traceback (most recent call last): File "/tmp/e2esetup.py", line 2, in <module> django.setup() File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 17, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 55, in __getattr__ self._setup(name) File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup % (desc, ENVIRONMENT_VARIABLE)) django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. Code being run in docker: docker exec -it $DOCKER_ID python /tmp/e2esetup.py My code: import django django.setup() from django.conf import settings from django.contrib.auth.models import User from apps.account.models import Profile from apps.organisation.models import Organisation .... #rest is fine for sure I'm new to django and docker, from what I can tell I need to set the environment however I don't know how, running through manage.py does this for you or something, so if I were to run a python file through the interpreter, I have to do this manually, however I dont know how. I also read that I need to pipe the docker environment somehow, but I'm not sure what that means either, any help is appreciated!
- 
        Test case data stays in Django development database SeleniumI have a simple form for registering new user. I wrote a test case for it. It looks as follows: class AccountTestCase(LiveServerTestCase): def setUp(self): self.selenium = webdriver.Firefox() super(AccountTestCase, self).setUp() def tearDown(self): self.selenium.quit() super(AccountTestCase, self).tearDown() def test_register(self): selenium = self.selenium #Opening the link we want to test selenium.get('http://localhost:8000/register/') #find the form element first_name = selenium.find_element_by_id('id_first_name') last_name = selenium.find_element_by_id('id_last_name') username = selenium.find_element_by_id('id_username') email = selenium.find_element_by_id('id_email') password1 = selenium.find_element_by_id('id_password1') password2 = selenium.find_element_by_id('id_password2') submit = selenium.find_element_by_id('btn_signup') #Fill the form with data first_name.send_keys('abc') last_name.send_keys('abc') username.send_keys('abc') email.send_keys('abc@gmail.com') password1.send_keys('abcabcabc') password2.send_keys('abcabcabc') #submitting the form submit.send_keys(Keys.RETURN) #check the returned result self.assertTrue('Success!' in selenium.page_source) When I ran the test case for the first time it passed with flying colors, but on the second run it failed. After little investigation I realized a user with credentials from test cases is already created in my database. Thus, when I ran test case for second time it failed to create a new user, as user with these details is already present. (I can see user from Django admin). I believe this is not the expected behaviour of LiveServerTestCase(or any type of test case). In setup, a temporary database is created, test case is ran on it, and destroyed in tearDown phase. I want …
- 
        django default profile imagei'm trying to setup a default profile image url using an image on my static files . when i have a profile image using this work fine <img src="{% if user.avatar %}{{ user.avatar.url }}{% endif %}"> and when i try the default image <img src="{% static 'img/default-avatar.png' %}"> works fine as well but when i clear the image trying to show the default image i get ValueError at : The 'avatar' attribute has no file associated with it. #my model class User(AbstractUser): #otherstuff avatar = models.ImageField(null=True ,blank=True) #morestuff #template <img src="{% if user.avatar %}{{ user.avatar.url }}{% else %}{% static 'img/default-avatar.png' %} {% endif %}">
- 
        Make new custom view at django adminSorry, I am still new at django. I want to make custom view at admin site that is not related to my model. I have read the documentation (https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_urls), but does not work. Reading some tutorials does not work too... Here is what I tried: admin.py from django.contrib import admin from django.urls import path from .models import Question from django.http import HttpResponse class CustomAdminView(admin.ModelAdmin): def get_urls(self): urls = super().get_urls() my_urls = [ path(r'^my_view/$', self.admin_view(self.my_view)) ] urls = my_urls + urls return urls def my_view(self, request): return HttpResponse("Hello, world.") admin.site.register(Question) urls.py from django.contrib import admin from django.urls import path from django.conf.urls import include, url admin.autodiscover() urlpatterns = [ path(r'polls/',include('polls.urls')), path('admin/', admin.site.urls), ] when I go to admin/my_view the result is 404 not found. I tried by extending the AdminView too. admin.py from django.contrib.admin import AdminSite from django.urls import path from .models import Question from django.http import HttpResponse class CustomAdminView(AdminSite): def get_urls(self): urls = super().get_urls() my_urls = [ path(r'my_view/', self.admin_view(self.my_view)) ] urls = my_urls + urls return urls def my_view(self, request): return HttpResponse("Hello, world.") custom_admin = CustomAdminView() custom_admin.register(Question) urls.py from django.contrib import admin from django.urls import path from django.conf.urls import include, url from polls.admin import custom_admin admin.autodiscover() urlpatterns = [ path(r'polls/',include('polls.urls')), path('admin/', …
- 
        Perform Custom logic after django-paypal successful transactionI'm working on a project in which I'm using Python(3.6) and Django(1.10), in this project I need to implement PayPal Express Checkout to receive payments.Actually, we are selling certifications from our organizations.The certificate will be generated automatically after successful payment transaction from PayPal. The problem is, I don't know how to handle signals after successful payment from PayPal. Here's what I have tried: From views.py: def payment_process(request): paypal_dict = { 'business': settings.PAYPAL_RECEIVER_EMAIL, 'amount': '5.00', 'item_name': 'Certificate from INC.', 'currency_code': 'USD', 'ret urn_url': 'http://127.0.0.1:8000/users/done', 'cancel_return': 'http://127.0.0.1:8000/users/cancel', 'isPayment': 'True', } valid_ipn_received.connect(show_me_the_money) form = PayPalPaymentsForm(initial=paypal_dict) return render(request, 'users/generateCert.html', {'form': form}) @csrf_exempt def payment_done(request): print(valid_ipn_received.connect(show_me_the_money)) return generate_certificate(request) @csrf_exempt def payment_canceled(request): return render(request, 'users/payment_canceled.html') def generate_certificate(request): template = get_template('users/certificate_template.html') minutes = int(request.user.tagging.count()) * 5 testhours = minutes / 60 hours = str(round(testhours, 3)) context = { "fullname": request.user.first_name + ' ' + request.user.last_name, "date": datetime.date.today(), "hours": hours, "today": "Today", } html = template.render(context) pdf = render_to_pdf('users/certificate_template.html', context) if pdf: response = HttpResponse(pdf, content_type='application/pdf') filename = "Invoice_%s.pdf" % "12341231" content = "inline; filename='%s'" % filename download = request.GET.get("download") if download: content = "attachment; filename='%s'" % filename response['Content-Disposition'] = content return response return HttpResponse("Not found") Here are my Templates: generateCert.html {% block content %} {% csrf_token %} …
- 
        Trying to replace default HTML widgetsI'm making a framework to improve the development of an existing system. My main task was to make said system responsive, and we settled in using material design. we're using django version 1.9. We've tried a lot of existing frameworks (django material, grappelli, etc), but we decided to develop our own, because if we were to use an existing framework we'd have to hack the sh*t out of it, basically. The thing is, right now I need to be able to render HTML widgets so that materialize (the library we're using) displays them nicely. I know that, as far as what I've read (pretty much anywhere), this is not possible by default. So I've come up with two ways to do so (I implemented a quick and dirty version of the second and it works, kind of), but I find both of them to be extremely... not elegant. The first one consists on creating our own database fields, inheriting from the ones defined in django, overwriting the formfield method to use custom form fields (which we would create by inheriting from django's ones and making them use our custom widgets). I (clearly) haven't implemented this one because it seems to …
- 
        How to pass custom elements list to the class attribute properly?I have the line in my template: <div class="class1 class2 class3 {{ foo_classes }}"> If the foo_classes is empty I get class="class1 class2 class3 ". What I want to get is class="class1 class2 class3" with no additional space at the end of the classes list. <div class="class1 class2 class3{{ foo_classes }}"> If I delete the space (look at the line above) then I get class="class1 class2 class3class4 class5", which is no better. How do I pass additional classes to avoid getting unnecessary space at the end of the classes section if the foo_classes is empty?
- 
        Error when including file urls in django frameworkI am using django framework to make my first app in python. But when i edit urls.py and add this line " url[r'^firstApp' ,include('firstApp.urls')), " it is giving me this error enter image description here
- 
        Django: Find an item in a list that is not in DatabaseI have a list and I want to find whether any items in this list are not in the database. Using the object.exclude() Django function I only find which elements are in my database that are not in my list: Gene.objects.exclude(gene_name__in=self.gene_list) I am currently getting the items I have in my list that aren't in the database using this code: obj = Gene.objects.filter(gene_name__in=self.gene_list) database_genes = [o.gene_name for o in obj] genes_not_in_db = [g for g in self.gene_list if g not in database_genes] This is however rather messy - is there a better way / inbuilt Django function to do this? Thanks
- 
        Como filtrar ModelMultipleChoiceField baseado em outro campo? / How to filter a ModelMultipleChoiceField based on another field?Based on the form below, I would like to know If Is there a way (or a plugin) to use the field tipo_indicador to filter indicadores field: Baseado no form abaixo, gostaria de saber se existe alguma forma (ou plugin) de utilizar o field tipo_indicador para filtrar o field indicadores: tipo_indicador = forms.ModelChoiceField( queryset=TipoIndicador.objects.all(), label=u'Tipo de indicador', required=False, ) indicadores = forms.ModelMultipleChoiceField( label= _(u'Indicadores'), required=False, queryset=Indicador.objects.all(), widget=admin_widgets.FilteredSelectMultiple(verbose_name=_(u'indicadores'), is_stacked=False) )
- 
        Best way to refresh graph without page refresh (Python Django, ajax)A bit of a general question - I am looking for ways to refresh a graph on a Django page based on user choices. The page has a graph, a few drop boxes where you can select parameters and a refresh button. Currently, I can capture the selections via ajax to my Django view and generate new data from database for the graph. I now need to feed that newly-generated data back into the graph and refresh it without a page refresh. Could anyone recommend the best methods of doing this?
- 
        Convert template layout into crispy forms layoutI am currently trying to convert a django template that I have been using into a django-crispy-forms Layout. I am having some problems doing this as I want to do it on an inline formset that is currently being made with django-extra-views. I have attempted to do this but have not got the desired result so far, and the docs on this subject aren't exceedingly helpful (in my opinion). I have had no problems with changing my other form layouts to use crispy forms just the formsets. Currently, my template looks like this: <div class="col-md-8 col-lg-8"> <form role="form" method="post"> {% csrf_token %} {{ form|crispy }} <div id="formset"> <div class="alert alert-info" role="alert"> Field names <strong>must</strong> be unique. </div> {{ field_inline.management_form }} {{ field_inline.non_form_errors }} {% for form in field_inline.forms %} {{ form.non_form_errors }} <div id="{{ field_inline.prefix }}-forms"> <div class="form-inline"> {% for field in form.visible_fields %} <div class="form-group"> <label for="{{ field.id_for_label }}" class="form-control-label m-2 requiredField"> {{ field.label }} <span class="asteriskField">*</span> </label> {{ field|add_class:"form-control" }} {{ field.errors }} </div> {% endfor %} {% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} </div> </div> {% endfor %} </div> <hr> <button class="btn btn-primary pull-right ml-1" type="submit">{% trans "Next" %}</button> <a class="btn btn-light …
- 
        Open RDP in Web page or with X11 forwardingi'am building a bastion server so the user can connect over the bastion server over ssh then he will connect to allowed_hosts however there is hosts that uses RDP sessions so can we use RDPY secript over Forwarding X11 ?? if the answer is yes please help tell me how ? either how can we implement the RDPY script over a django web application ?
- 
        __str__ returned non-string (type list)I am having a django app in which I am storing the json variable.I have stored the json variable through admin and I am trying to print it in shell.My main aim is to pass this variable to a webpage with ajax method.But first when I was trying to print it in shell I get this error __str__ returned non-string (type list) My models.py is of this form from django.db import models from django.utils import timezone from jsonfield import JSONField # Create your models here. class newgrid(models.Model): data = JSONField() def __str__(self): return self.data My JSON variable is of this form [{"col":1,"row":1,"size_x":1,"size_y":1},{"col":2,"row":1,"size_x":1,"size_y":1},{"col":3,"row":1,"size_x":1,"size_y":1},{"col":4,"row":1,"size_x":1,"size_y":1},{"col":1,"row":2,"size_x":1,"size_y":1},{"col":2,"row":2,"size_x":1,"size_y":1},{"col":3,"row":2,"size_x":1,"size_y":1},{"col":4,"row":2,"size_x":1,"size_y":1},{"col":1,"row":3,"size_x":1,"size_y":1},{"col":2,"row":3,"size_x":1,"size_y":1},{"col":3,"row":3,"size_x":1,"size_y":1},{"col":4,"row":3,"size_x":1,"size_y":1},{"col":5,"row":1,"size_x":1,"size_y":1}] In shell I ran following commands from testforweb.models import newgrid newgrid.objects.all() It initially returned this <QuerySet [<newgrid: newgrid object (1)>]> But then I added def __str__(self): return self.data Just to see the actual JSON variable.But I am getting the error How to see the actual JSON variable which I inserted through admin coz I need to send it to webpage as it is
- 
        TypeError: ufunc 'ndtri' not supported for the input typesInternal Server Error: /reports/rschighlevel/ Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view return view_func(request, *args, **kwargs) File "/home/pulsedev2/prod/pulse.corp.uber.internal/ats/reports/views.py", line 167, in rschighlevel print norm.ppf(a) File "/usr/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 1514, in ppf place(output, cond, self._ppf(*goodargs) * scale + loc) File "/usr/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 2187, in _ppf return _norm_ppf(q) File "/usr/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 2133, in _norm_ppf return special.ndtri(q) TypeError: ufunc 'ndtri' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' Code : from scipy.stats import norm from scipy.special import ndtri import pdb sigma = [] for i in usigma: a = (1-i[6]) print type(a) print norm.ppf(a) - Error Line sigma.append([i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7], a]) print sigma
- 
        How to access the value from select2 in djangoI'm a beginner in this.I have a select2 plugin with multiple inputs.I want to get all the option values when submitted as an array (to query in views.py). for eg: [2,134,4,65] template <div class="col-sm-9"> <h1>Hello {{user.first_name}} {{user.last_name}}....</h1> <h4>Please Specify Your Symptoms</h4> <select class="js-example-basic-multiple" name="states[]" multiple="multiple" style="width:300px"> {% for sym in all_symptoms %} <option value={{sym.syd}}>{{sym.symptoms}}</option> {% endfor %} </select> <button type="submit" class="btn btn-success">Submit</button> </div> <script> $(document).ready(function() { $('.js-example-basic-multiple').select2(); }); </script> views.py
- 
        CRFS token problems consuming django-oauth-toolkitI deployed a Django OAuth Toolkit Oauth2 provider following the official tutorial https://django-oauth-toolkit.readthedocs.io/en/latest/tutorial/tutorial_01.html I set the callback URI pointed to the next Django view and I try to retrieve some user information form the oauth server using an ad-hock view decorated with Login_required. This is the callback view. class OauthLoginView(View): def get(self, request, *args, **kwargs): code = request.GET["code"] next = kwargs.get("next", reverse('home')) URI = "http://" + request.META['HTTP_HOST']+reverse('oauth') # Ask /me from auth.deusto.io r = PM.request(method='post', url="http://auth/o/authorize/", fields={ "grant_type": "authorization_code", "client_id": "lololo", "client_secret": "lalala", "code": code, "redirect_uri": URI, "csrftoken": request.COOKIES['csrftoken'] }) r = PM.request(method='get', url="http://auth.deusto.io/api/me", headers={ "Authorization": r.data["token_type"] + r.data["access_token"] }) if r.status == 200: me = r.data["object"] try: user = User.objects.get_by_natural_key(me.username) except ObjectDoesNotExist as ex: user = User(username=me.username) login(request, user) return redirect(next) return HttpResponse(content=r.data, status=r.status) This is the View from the Oauth serve: class MeView(View): def get(self, request, *args, **kwargs): if request.user.is_authenticated: self.me = request.user context = {"username": self.me.username} return self.render_to_response(context) else: return HttpResponseForbidden("Not logged") def render_to_response(self, context, **response_kwargs): return JsonResponse(context) I call to the Oauht server and try to get the access token thorough sending the code received from the callback. I get a error from CsrfViewMiddleware. Althought I send the csrf token and I set CORS_ORIGIN_REGEX_WHITELIST in the …
- 
        Clarity on Setting up Docker containers for django projects?I'm experimenting with docker and have some basic hands-on with it. I would like to know how to structure the containers to scale in a better way. Auth Container - Using Auth0 for Authentication only. With JWT for authentication Profile Container- A python app to store user profile along with MongoDB as a database. I prefer keeping this in a separate container because it will not be used much as the other services. Blog Container- This is another python app that allows users to write/edit articles and uses the same MongoDB as the profile container. My Question is how two different python apps share the authentication from the auth container. I have developed similar monolithic apps with Django, but as a single project. I would like to do the same but both the profile and blog as different projects itself. What kind of Structure should I follow to implement such projects?
- 
        Django form is still full after sign upI have an app in django 1.11. Below is the view with the form where the user can sign up for the event, after saving he gets a message about the details - on the same page, at the same url. But, after saving the form is completed and after pressing F5 the next saving is performed. How can I avoid this? I think something with the form_valid method is wrong. class EventDetailView(DetailView, CreateView): model = models.Event form_class = forms.ParticipantForm context_object_name = 'event' template_name = 'events/event_detail.html' def get_success_url(self): return reverse('events:detail', kwargs={'slug': self.kwargs['slug'], 'pk': self.kwargs['pk']}) def form_valid(self, form): self.object = form.save() context = self.get_context_data() context['registered_event'] = context['event'] return self.render_to_response(context)
- 
        Why shouldn't you use PHP within Django? [on hold]I have seen in several websites people saying it is a really bad idea to mix PHP scripts within a server running Django. Plus, it is (apparently) a quite hard thing to do. Still, I don't understand why. Although I get that both run on server side I do not understand why you shouldn't use some PHP if there's anything you think would work better than python (or you just feel like using it). So, can/should you use PHP in a python server using Django? How and why? Thank you <3
- 
        Can i read a django file object straight into pandas dataframe?I want to load a simple \t separated file into a pandas dataframe that I have loaded using django: views.py if request.method == 'POST': files = request.FILES.getlist('file_field') for f in files: df = pd.read_csv(f, sep='\t')
- 
        Unable to install hiredis on Windows server 2012As the title says, when trying with PowerShell as the library is required by my django project. command used : pip install hiredis installed on system : visual studio 2015 (for C compiler), .NET Framework 4.5., 4.6., Microsoft visual C++ 2012, 2013, 2015, WIndows 10 SDK, python 3.5.2, Python Launcher, winrar? The full error : PS C:\Programs\XAMPP\htdocs\mySiteProject> pip install hiredis Collecting hiredis Using cached hiredis-0.2.0.tar.gz Installing collected packages: hiredis Running setup.py install for hiredis ... error Complete output from command c:\users\administrator\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\2\\pip-build-tx0pbghm\\hiredis\\setup.py';f=ge tattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec '))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-4bydtxdv-record\install-record.txt --single-version-ext ernally-managed --compile: running install running build running build_py creating build creating build\lib.win-amd64-3.5 creating build\lib.win-amd64-3.5\hiredis copying hiredis\version.py -> build\lib.win-amd64-3.5\hiredis copying hiredis\__init__.py -> build\lib.win-amd64-3.5\hiredis running build_clib building 'hiredis_for_hiredis_py' library error: Unable to find vcvarsall.bat ---------------------------------------- Command "c:\users\administrator\appdata\local\programs\python\python35 \python.exe -u -c "import setuptools, tokenize; __file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\2\\pip-build-tx0pbghm\\hiredis\\setup.py';f=getattr(tokenize, 'open',open)(__file__); code=f.read().replace('\r\n', '\n');f.close(); exec(compile(code, __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-4bydtxdv-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-build-tx0pbghm\hiredis\