Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Is there a way to have django admin/add return an existing match when unique_together is defined?
I have a basic model something like class Mode(models.Model): """ Class to define optional mode for a test instance """ name = models.CharField(blank=True,null=True,max_length=64,unique=True) modeswitches = models.ManyToManyField(Modeswitch,blank=True,null=True) class Modeswitch(models.Model): """ A simple switch to be used optionally by a mode that is a pure database object. This will be a simple key=>value pair """ name = models.CharField(max_length=128,blank=True,null=True) value = models.CharField(max_length=128,blank=True,null=True) class Meta: unique_together = ['name','value'] My problem is...I do want this unique_together to be enforced in my application/database but, intuitively, the number of modeswitches will get VERY large so I want the user to just be able to conveniently add a new modeswitch in Django's admin interface popup to a parent object without checking/searching through potentially hundreds of existing modeswitch objects. Ideally, they would just use the admin/add and it would either create a new modeswitch and add it to the parent form or use the existing one if their name/value pair in the add form matches a modeswitch already and return to the original form with it selected. Initially, I get a form error because of the duplicate name/value pair (expected); but, I can't figure out how/what to override to change this behavior. I've tried the save method in, both, … -
Django Queryset Select reverse
I'm trying to get the father name value of a model I hope you can help me. class Datos_usuario_DB(models.Model): activo = models.CharField(max_length=1) nombre = models.CharField(max_length=250) email = models.CharField(max_length=250) telefono = models.CharField(max_length=250) comentarios = models.TextField() fecha = models.DateTimeField() class Datos_respuesta_DB(models.Model): foraneo_datos_empresa_DB = models.ForeignKey(Datos_usuario_DB) nombre = models.CharField(max_length=250) comentarios = models.TextField() fecha = models.DateTimeField() What I'm trying to get is nombre in Datos_usuario_DB, When I arrive up to this point I do not know what else do a = Datos_respuesta_DB.objects.filter(foraneo_datos_empresa_DB=2) Any idea ? -
Django view in view
I have two Class Based Views: class UserView(ListView): model = JiraUser template_name = 'users.html' def get_context_data(self, **kwargs): context = super(UserView, self).get_context_data(**kwargs) context['form'] = UserCreateFormView.as_view() return context def post(self, request, *args, **kwargs): form = JiraUserForm(request.POST) if form.is_valid(): user = form.save(commit=False) user.save() else: HttpResponseForbidden() return HttpResponseRedirect(reverse('users-list')) class UserCreateFormView(View): template_name = 'create_user.html' form_class = JiraUserForm def get(self, request): form = self.form_class() return render(request, self.template_name, {'form': form}) And I'd like to render UserCreateFormView in UserView. How can I do it? Now I'm trying change the view context and print form in view, but it isn't working. -
Is it possible to design a web application using only Python and django?
I want to develop a web application using pure python and django. Can I accomplish with out using angularJS or any Javascript? I know to use angular tags in django. But will this be necessary for a perfect running application? {{% verbatim %}} {{% endverbatim %}} -
Issue with creating admin Django
I have an uber like website where users can sign up to either use the service or provide the service, thus I have two different models CustomerProfile and WorkerProfile, each extends User. There are also two different registration forms for each model and you sign up depending on what you want to do. The problem is that each time i create and admin, this admin is assigned the same profile as the last user that signed up, so if the last person that registered did so as worker and I were to create an admin at that time the admin would also be found in WorkerProfile but not CustomerProfile. This has lead to errors when trying to log in at 127.0.0.1:8000/admin/ such as: Exception Type: RelatedObjectDoesNotExist Exception Value: User has no customerprofile. Basically, whatever the last user registered as, I have to log in as admin with an admin account that has the same profile, this has lead me to creating admin1 and admin2, each of which were automatically assigned to WorkerProfile and CustomerProfile depending on whatever the last user registered as. How do I solve this issue? Why when I create an admin are they getting assigned to a … -
uwsgi + nginx configs not working with python3.5 virtualenv
I'm trying to use uwsgi + nginx for my django projects with python3.5. But configs doesn't work properly. Here are my config files: /lib/systemd/system/uwsgi.service [Unit] Description=uWSGI Emperor [Service] ExecStart=/usr/local/bin/uwsgi ‐‐ini /etc/uwsgi/vassals/emperor.ini Restart=always KillSignal=SIGQUIT Type=notify NotifyAccess=all [Install] WantedBy=multi‐user.target /etc/uwsgi/emperor.ini [uwsgi] emperor = /etc/uwsgi/vassals uid = www-data gid = www-data limit-as = 1024 logto = /var/log/uwsgi.log /etc/uwsgi/vassals/django_blog.ini [uwsgi] virtualenv = /home/valera/dev/env/env35 chdir = /home/valera/dev/www/local/django_blog env = DJANGO_SETTINGS_MODULE=django_blog.settings module = django_blog.wsgi:application socket = /tmp/django_blog.sock master = true processes = 2 chmod-socket = 664 vacuum = true /etc/nginx/sites-available/django_blog server { listen 80; server_name django-blog; location /static/ { alias /home/valera/dev/www/local/django_blog/static; } location / { include /etc/nginx/uwsgi_params; uwsgi_pass unix:///tmp/django_blog.sock; } } In uwsgi.log I get an error: ImportError: No module named site And on the web page I get: 502 Bad Gateway I tried add python plugins to my django_blog.ini plugins-dir = /usr/lib/uwsgi/plugins plugins = python3 But no difference. Still have the same error. When I put into virtualenv path to env with python2.7 it works, but when I change it to env with python3.5 it doesn't. Can somebody explain me this problem? -
How to pass Django data to an external JS file?
I am working on a Django project. I would like to pass a data from Django's views.py into a javascript file, run the js function then render the return value into my html page. I am not using a form in this project. Can someone please guide me on how to approach this? Most answers I see here are currently outdated and I've tried different approaches with no luck. I am using Python v2.7. Thank you in advance! -
serving image files from django admin
Sorry if this has been asked countless times but I've spent a solid 5 hours scouring the internet on this problem and am still unsuccessful. Essentially, for a site I'm building (first website btw so new to django) I want to provide to the administrator a means to deploy images from the admin pages, which will be used to drive the business logic from the customer's perspective. However I want the administrator to be able to view these images from the admin page too. So I want one common images folder to be accessible from app views and the admin view. I currently have only one app named retailFilters. Now actually deploying some files to my media/images folder isn't a problem, I add a record (specifying an image to upload) on the admin page and sure enough, the files are waiting exactly where I expected to be. I also realise I have to tell django where to serve them from, and from poking around the internet I have my MEDIA_ROOT, MEDIA_URL and urlpatterns defined as: settings.py ... parent_dir = os.path.abspath(os.path.dirname(__file__) + '/..') MEDIA_ROOT = os.path.join(parent_dir, 'media/') MEDIA_URL = 'media/' (and INSTALLED_APPS includes django.contrib.staticfiles)) urls.py urlpatterns = [ url(r'^admin/', admin.site.urls), ] … -
Importing with Django-excel
I want to upload a file through the admin interface, this is my view.py class SubirData(forms.Form): file = forms.FileField() def import_data(request): if request.method == "POST": form = SubirData(request.POST, request.FILES) def choice_func(row): q = Escalado.objects.filter(slug=row[0])[0] row[0] = q return row if form.is_valid(): request.FILES['file'].save_book_to_database( models=[Escalado], initializers=[None, choice_func], mapdicts= [ ['ID Incidente', 'Tipo Cliente', 'Caso HD', 'Categoria', 'Tipo', 'Elemento', 'Razon', 'Categoria_Tipo_Elemento_Razon', 'Estado', 'Sub Estado', 'Ciclo Fact', 'Tipo Cuenta', 'No Cta', 'Cta Maestra', 'Status del Servicio', 'No Doc', 'Plataforma', 'Tecnologia', 'Segmentacion', 'Fecha de Creacion', 'DIA', 'Fecha Hora Solucion', 'Clasificacion', 'Creado Por', 'Bandeja Resolutor', 'Grupo Resolutor', 'Individuo Asignado', 'Unidad Operativa', 'Canal Captura', 'Tiempo de Solucion', 'Reabierto', 'Reasignado', 'Retipificado', 'Idop RAC', 'Telefono', 'Nombre del Cliente', 'Apellido del Cliente', 'Apellido del Cliente', 'Telefono Alterno', 'Telefono Contacto Visita', 'Cliente Contactado', 'Antiguedad', 'Region', 'Estados Vzla', 'Ciudad', 'Bloque', 'Causa de la Falla', 'Motivo', 'Detalles', 'Monto Ajuste', 'Codigo Ajuste', 'Monto Reclamo', 'Plan', 'Plan Sva Promo', 'Servicio Sva', 'Marca Equipo', 'Modelo Equipo', 'Canal de Recarga Pago', 'Motivo de Reclamo', 'Nombre Completo', 'Estado Falla1', 'Region Falla', 'Ciudad Falla', 'Municipio Falla', 'Sector Falla', 'Tipo Senal Falla', 'TTC SG3', 'MarcaExterna Cvsc', 'En Horas TV', 'En Horas', 'Tipo Campana', 'En Altamira', 'Lineas Afectadas', 'Cliente Reincidente', 'Linea de Negocio,', 'Motivo de Reclamo Ajuste', 'Tono', 'Canal de Gestion', … -
Forcing unique email address during registration with Django
Is there a simple way to force unique email address's during registration with website built with Django? I've seen some "addons?" like HMAC, but it seems a bit too complicated for what I am trying to achieve. Also, would it be possible to accept registration only from a list of domains? (such as only emails from "@google.com") -
Is it possible to use a freshly created context variable anywhere in a Django template?
For a long time now, I have been trying to figure out how to work with lists created on the fly in Django templates, meaning being able to: create a list directly in a django template, add new elements to that list, concatenate 2 lists together. Those lists should be able to handle django objects and not only simple strings or so. For instance, in my case, I wanted my lists to be able to store form fields (example to follow). After many researches, I figured out that it was impossible to do that but with simple things, and that I had to create my own custom tags if I ever wanted to achieve my purpose. My custom tag is written below. Please notice that this post helped me to do so. The issue I am facing with The custom tag works, and I use it in a for loop. The list generated here is correctly evolving according to the loop, and I can call it like any variable while still being in the loop (because it was exported in Django context): {{ listName }} But! Once I'm outside that loop, my list does not seem having being updated at … -
Django not storing the exact UTC time in db
I have a Django API/PostgreSql project, where i try to store the datetime in UTC format, which later i will convert to a correct timezone in the front end with angular. My current settings are: USE_TZ = True TIME_ZONE = 'US/Eastern' I was first using UTC, but for some reason the datetime was stored as +1 hour, so i set the time zone to my servers time zone Model: date = models.DateTimeField(default = timezone.now()) But still when i retrieve the inserted record, the time is -3 minutes late. While when i use the code bellow, it stores a correct time: date = models.DateTimeField(auto_now_add=True) Am i missing something in the configuration ? What TIME_ZONE should i use, server location time_zone, or it has to do with the servers time setup ? -
Jquery Countdown Plugin Not Working
I am using JQuery's countdown plugin in my Django application. I set up the countdown init script in a JQuery document.ready callback function, and I can see the javascript load when I check the network tab in Chrome's web inspector, but the plugin doesn't show up. I logged the element to the web console to make sure that it existed when I tried to call JQuery.countdown's .countDown method that kickstarts the plugin. It does in fact exist, but there is just empty space in between the tags. There are also no errors in the console. Scripts "both JQuery and JQuery countdown being loaded" <!-- SCRIPTS --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script type='text/javascript' src="/static/js/menu.js"></script> <script type='text/javascript' src="/static/js/user_actions.js"></script> <script type="text/javascript" src="/static/js/jquery.countdown/jquery.countdown.js"></script> {# <script type='text/javascript' src="https://cdnjs.cloudflare.com/ajax/libs/jquery-countdown/2.0.2/jquery.countdown.js"></script>#} <!-- JQUERY Countdown --> <script type="text/javascript"> $(document).ready(function () { var clock = $("#countdown"); console.log(clock); $("#countdown").countDown("2017/12/01", function (event) { console.log("CLOCK WORKS"); $(this).text( event.strftime('%D days %H:%M:%S') ); }); }); </script> HTML {% block content %} <div id='billboard' class='flexslider billboards'> <ul class='slides'> {% for billboard in billboards %} <li class='slide' style="background-image: url('{{ billboard.image }}');"> <div class='transparent-overlay'></div> <div class='container'> <div class='slide-content'> <h1>{% inplace_edit "billboard.header" %}</h1> </div> </div> </li> {% endfor %} </ul> </div> <div class="home-sub-container"> <div class="col-xs-8" style="border: 1px solid lime;"> … -
This model works, but I do not understand how the signal works
I have the following in model.py: from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) university = models.CharField(max_length=30, blank=True) birth_date = models.DateField(null=True, blank=True) ROLE = ( ('CUSTOMER', 'User'), # (value to be set on model, human readable value) ('WORKER', 'Worker'), ) role = models.CharField(max_length = 20, choices = ROLE, default = 'USER') def __str__(self): return self.user.username @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() I also have a corresponding form that, when filled out and sumbitted, saves to the database as a Profile properly. What I do not understand is instance.profile.save() how does this work? To me it appears it should be instance.Profile.save() since, Profileexists. I am not sure where this lowercase profileis coming from? -
How can I send email to admin for approval or deny, When new user register in website using django? Any help will be appreciated
I am creating a website that allows the user to get direct communication with other member but the new user needs to get approval to login website. Now I want to send an email to admin with new user's bio and approve or deny the link. -
NGINX cache always returns status=MISS
I'm having an issue where the NGINX server returns MISS for subsequent requests to a GUNICORN/django backend. I have yet to get a single HIT. The HTTP header is set with appropriate expiration time from originating server. I've checked all my config files but don't find anything incorrect. This is what I see when I run a simple request on the server itself (I get the same result when requesting remotely as well, by the way): http -p HBh http://10.1.1.5:443/api/1/vehicles GET /api/1/vehicles HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Connection: keep-alive Host: 10.1.1.5:443 User-Agent: HTTPie/0.9.6 HTTP/1.1 200 OK Allow: OPTIONS, GET Cache-Control: max-age=3600 Connection: keep-alive Content-Encoding: gzip Content-Type: application/json Date: Wed, 16 Aug 2017 18:27:30 GMT Expires: Wed, 16 Aug 2017 19:27:30 GMT Server: nginx/1.10.3 (Ubuntu) Transfer-Encoding: chunked X-Cache-Status: MISS <-- :( X-Cache-Upstream-Connect-Time: 0.000 X-Cache-Upstream-Header-Time: 0.010 X-Cache-Upstream-Response-Time: 1502908050.768 <--- ? X-Frame-Options: SAMEORIGIN X-Request-Time: 0.010 X-SG-LOCATION: /api/ X-SG-URI: /api/1/vehicles X-Upstream-Addr: unix:/srv/API/fleet_api/backend/mysite/mysite.sock Note: The upstream response time being incorrect is a known bug in NGINX for some cases. In this case it may be because something is not configured correctly. This is my /etc/nginx/nginx.conf file: user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 1024; } http { ## # Basic Settings ## … -
Django REST Framework set related field by another field than PK (without NestedSerializer)
I have the following serializer: class OrderSerializer(serializers.ModelSerializer): pair_name = serializers.ReadOnlyField(source='pair.name', read_only=False) deposit_address = NestedReadOnlyAddressSerializer(many=False, read_only=True) withdraw_address = NestedAddressSerializer(many=False, read_only=False, partial=True) pair.name is a unique field. Is it possible to allow the PK assignment (order.pair) using the pair name. [POST] {'withdraw_address': 'x', deposit: 'address': 'y', 'pair_name': 'ETHBTC'} Instead of: [POST] {'withdraw_address': 'x', deposit: 'address': 'y', 'pair': 1} Tried looking thought the docs and did not find a solution. Googling for an hour did not help as well. Currently lookup_field can only be set on ViewSet and not on Serializer. -
Django admin static files not working on Heroku with whitenoise
I have a django site deployed to heroku and regular static files are working, but admin static files are not. Here's my settings.py PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') STATIC_URL = '/static/' STATIC_FILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' STATICFILES_DIRS = [os.path.join(PROJECT_ROOT, "staticfiles")] These settings work to serve my normal static files, but like I said, the admin files are not working properly. I can't tell if it's a limitation of whitenoise and I need to host files elsewhere, or if I'm missing something. I'd prefer to keep everything within heroku as it's free for me now. -
Multiple django projects on apache
I have two separate django projects (each associated with their own virtualenv) and I am attempting to deploy both of them, however I can only get one at a time as of now. I have tried these with no luck (most all resources are fairly old) Deploying multiple django apps on Apache with mod_wsgi multiple django sites with apache & mod_wsgi http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html This is my current set up (with only the first virtual host working) <VirtualHost *:80> WSGIScriptAlias / /home/4rsenal/f_proj/f_proj/wsgi.py ErrorLog ${APACHE_LOG_DIR}/error.log CustumLog ${APACHE_LOG_DIR}/access.log combined Alias /static/ /home/4rsenal/f_proj/static <Directory /home/4rsenal/f_proj/static> Require all granted </Directory> <Directory /home/4rsenal/f_proj/f_proj> <Files wsgi.py> Requier all granted </Files> </Directory> WSGIProcessGroup f_proj WSGIDaemonProcess f_proj python-home=/home/4rsenal/f_proj/f_projenv python-path=/home/4rsenal/f_proj </VirtualHost> <VirtualHost *:80> WSGIScriptAlias / /home/4rsenal/m_proj/m_proj/wsgi.py ErrorLog ${APACHE_LOG_DIR}/error.log CustumLog ${APACHE_LOG_DIR}/access.log combined Alias /static/ /home/4rsenal/m_proj/static <Directory /home/4rsenal/m_proj/static> Require all granted </Directory> <Directory /home/4rsenal/m_proj/m_proj> <Files wsgi.py> Requier all granted </Files> </Directory> WSGIProcessGroup m_proj WSGIDaemonProcess m_proj python-home=/home/4rsenal/m_proj/m_projenv python-path=/home/4rsenal/m_proj </VirtualHost> To get to the sites when they work, I go to http://[ipaddress]/f_app/ or http://[ipaddress]/m_app/, I just can't seem to figure out how to have them both up at the same time. I've tried separating them into different conf files, put them under the same virtual host, none of which have worked for me yet. -
How is the worflow of tearDown class from unittest.testCase?
How is the workflow of tearDownClass from unittests.testcase? Is it called after each test method, or just in the end to "close the connection" of the test class? Its explanation wasn't clarifying for me: https://docs.python.org/3/library/unittest.html#unittest.TestCase.tearDown -
Django - missing 1 required positional argument: 'request'
I'm getting the error get_indiceComercioVarejista() missing 1 required positional argument: 'request' when trying to access the method get_indiceComercioVarejista. I don't know what it's wrong with it. views: from django.http import JsonResponse from django.shortcuts import render, HttpResponse import requests import pandas as pd from rest_framework.views import APIView from rest_framework.response import Response class ChartData(APIView): authentication_classes = [] permission_classes = [] def get(self, request, format=None): data = { 'customer' : 10, 'sales': 100 } return Response(data) def get_indiceComercioVarejista(self, request, format=None): data = { 'customer' : 10, 'sales': 100 } return Response(data) urls: from django.conf.urls import url from . import views from django.contrib.auth.views import login urlpatterns = [ url(r'^$', views.home), url(r'^login/$', login, {'template_name': 'Oraculum_Data/login.html'}), url(r'^cancerColo/$', views.cancerColo), url(r'^educacao/$', views.educacao), url(r'^comercio/$', views.comercio), url(r'^saude/$', views.saude), url(r'^api/chart/data/$', views.ChartData.as_view()), url(r'^api/chart/indiceVolumeReceitaComercioVarejista/$', views.ChartData.get_indiceComercioVarejista) ] Can someone help me, please? -
Should an Uber like app have two models, one for customers and one for workers
I am trying to make an uber like website, where you can sign up as a customer (someone who uses the service) or a worker (someone who provides the service). Should I create two models for each of these and then have different registration forms for each. Or should I have one generic profile model with a role field where upon registration the user could select whether they want to be a customer or a worker? I ask because there are fields that the customer would have that would be useless to the worker and vice versa (such as the "looking for a ride now" field that only a customer would activate when they are trying to find a ride. Is it okay to give all fields to both sides with one profile model and then leave them blank if they do not apply to the customer/worker? -
Sorting items by drag and drop in django
In my django project I show a list of books in template. Book model has position field which I use to sort books. I'm trying to sort this list by drag and drop list items but my next code dont work well. I use JQuery UI. It works in frontend but dont change position field`s value when user drag and drop list item. Can someone help me to improve my js and view code. I am comfused. I would be grateful for any help. models.py: class Book(models.Model): title = models.CharField(max_length=200, help_text='Заголовок', blank=False) position = models.IntegerField(help_text='Поле для сортировки', default=0, blank=True) class Meta: ordering = ['position', 'pk'] html: <div id="books" class="list-group"> {% for book in books %} <div class="panel panel-default list-group-item ui-state-default"> <div class="panel-body">{{ book.title }}</div> </div> {% endfor %} </div> urls.py: url(r'^book/(?P<pk>\d+)/sorting/$', BookSortingView.as_view(), name='book_sorting') JS: $("#books").sortable({ update: function(event, ui) { var information = $('#books').sortable('serialize'); $.ajax({ url: "???", type: "post", data: information }); }, }).disableSelection(); views.py: class BookSortingView(View): @method_decorator(csrf_exempt) def dispatch(self, request, *args, **kwargs): return super(BookSortingView, self).dispatch(request, *args, **kwargs) def post(self, request, pk, *args, **kwargs): for index, pk in enumerate(request.POST.getlist('book[]')): book = get_object_or_404(Book, pk=pk) book.position = index book.save() return HttpResponse() -
django similar post display error
I am working on an application and I am trying to show related posts based on tags. I have everything working fine but when I load the detail view in the browser I get an error saying type object 'Post' has no attribute 'published' I have posted my codes below. Model: class Post(models.Model): """docstring for Post.""" STATUS_CHOICES = ( ('drafts', 'Draft'), ('published', 'Published'), ) user = models.ForeignKey(settings.AUTH_USER_MODEL, default=1) #blank=True, null=True)#default=1 title = models.CharField(max_length = 120) slug = models.SlugField(unique= True) draft = models.BooleanField(default = False) publish = models.DateField(auto_now=False, auto_now_add=False) content = models.TextField() tags = TaggableManager() status = models.CharField(max_length=10,choices=STATUS_CHOICES, default='published') updated = models.DateTimeField(auto_now=True, auto_now_add=False) timestamp = models.DateTimeField(auto_now=False, auto_now_add=True) View: def view(request, slug =None): instance = get_object_or_404(Post, slug =slug) if instance.draft or instance.publish > timezone.now().date(): redirect(index) #content_type = ContentType.objects.get_for_model(Post) #obj_id = instance.id initial_data = { "content_type": instance.get_content_type, "object_id": instance.id } form = CommentForm(request.POST or None, initial=initial_data) if form.is_valid(): #print (form.cleaned_data) c_type = form.cleaned_data.get("content_type") content_type = ContentType.objects.get(model= c_type) obj_id = form.cleaned_data.get("object_id") c_content =form.cleaned_data.get("content") parent_obj = None try: parent_id = int(request.POST.get("parent_id")) except Exception as e: parent_id = None if parent_id: parent_query = Comment.objects.filter(parent__id= parent_id) if parent_query.exists(): parent_obj = parent_query.first() new_comment, created = Comment.objects.get_or_create( user = request.user, content_type = content_type, object_id = obj_id, content = c_content, … -
Curious behaviour with default Django http server
I've always been told that Django is a synchronous Web framework, and that its default webserver is slow, insecure, and worst of all - singly threaded. Looking at Django's documentation on their implementation of a webserver does not reveal much details: I'm told that it is "lightweight", and that the Django team recommends against its use in production. Searching on Stackoverflow reveals that any single request would hang another until the first is completed - what you'd expect. But here's the surprising bit I encountered while playing around with it - If I send a request for the server to sleep for 10 seconds (simulating long-running I/O), and another simultaneous request to simply load the index page, the index page is able to load immediately while the other request is processed. The exact same test, when tried on a configuration running behind NGINX/Gunicorn with a single Gunicorn worker process shows that the loading of the index page is stalled until the first request (sleep for 10 seconds) completes. This behavior is mirrored in a third test where Gunicorn is run without NGINX in front. This is behaviour I'd expect - but completely different from the default server! Why does this …