Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to use Q objects in Django
I am trying to understand how to make a simple search form for a website in Django. After some google search and few failures to do it on my own I ended up with a following code in a views.py where 'q' is value retrieved from the form: class BookSearchListView(BookListView): def get_queryset(self): result=super(BookSearchListView, self).get_queryset() query=self.request.GET.get('q') if query: query_list=query.split() result=result.filter(reduce(operator.and_,(Q(title__icontains=q) for q in query_list))) return result I already understand how it works and why there is reduce and operator.and_ (I mean, I think I understand). But I do not understand why a simple result=result.filter.(Q(somedbfield_icontains=q)) returns and error (even if input is a single word). I also don't understand why reduce needs to get bitwise value? -
Python/Django filtering
I'm trying to make html table and filter Frequency to LF, HF and UHF, when i'm pressing one or many of the checkboxes it should instantly show only these objects but i don't really know how to do it.. could anyone help me? models.py class Tags(models.Model): STATE_LF = 'LF' STATE_HF = 'HF' STATE_UHF = 'UHF' STATE_CHOICES = ( (STATE_LF, pgettext_lazy('LF Tag','LF')), (STATE_HF, pgettext_lazy('HF Tag','HF')), (STATE_UHF, pgettext_lazy('UHF Tag','UHF')) ) tag_name = models.CharField(max_length=250) tag_frequency = models.CharField(max_length=200, null=True, blank=True, choices=STATE_CHOICES) def __unicode__(self): return self.tag_name def get_absolute_url(self): return reverse('tag:index') views.py @login_required(login_url='/login/') def index(request): title = 'Tags' all_tags = Tags.objects.all() if request.method == 'POST': is_lf = request.POST.get('is_lf', None) is_hf = request.POST.get('is_hf', None) is_uhf = request.POST.get('is_uhf', None) # Now make your queries according to the request data if is_lf: LF = Tags.objects.filter(tag_frequency__gt=120, tag_frequency__lt=135) if is_hf: HF = Tags.objects.filter(tag_frequency__gt=12, tag_frequency__lt=15) if is_uhf: UHF = Tags.objects.filter(tag_frequency__gt=850, tag_frequency__lt=980) return render(request, 'tag/index.html' ,{'all_tags':all_tags, 'title':title, 'LF': filter, 'HF':filter, 'UHF':filter}) return render(request, 'tag/index.html' , {'all_tags':all_tags, 'title':title}) index.html <div><label for="input_lf"><input type="checkbox" name="is_lf" id="input_lf"> LF</label></div> <div><label for="input_hf"><input type="checkbox" name="is_hf" id="input_hf"> HF</label></div> <div><label for="input_uhf"><input type="checkbox" name="is_uhf" id="input_uhf"> UHF</label></div> <table id="select" class="table table-bordered table-hover resposive" cellspacing="0" width="100%"> <thead> <tr> <th><input type="checkbox" onClick="toggle(this)"></th> <th></th> <th>Name</th> <th>Frequency</th> </tr> </thead> <tfoot> <tr> <th></th> <th></th> <th></th> <th></th> </tr> </tfoot> <tbody> … -
Calling one django app api url inside another app for displaying in front end using reactjs
I am working on one project with django and reactjs.As I am getting response from api using django-restframework and display the api response in front end using reactjs. I have two django apps namely users and leave ,it has separate api-urls for each other. The problem is,when i call leave api url inside users app reactjs part i am not getting proper response.I want to call leave api urls in react part of users app and display in front end. Thanks in advance, Any help is appreciated. -
Django rest - Custom authentication backend with browsable api
I am using Django 1.11 and Django rest framework 3.6.2 I created a custom authentication backend MyAuthBackend(rest_framework.authentication.BasicAuthentication and added it to settings.py file REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES' : ('path.to.MyAuthBackend',) } My issue is that users are trying to log in via the browsable api and looks like the authentication backend the browsable api is using is not the default one. Where can I change that? I have to use my own auth backend in browsable api, Thank you. -
How to group array based on the same values
Please, confused with array in python. I want to group array based on the same values. Code: enter image description here id_disease = ['penyakit_tepung','hawar_daun'] for id_disease in id_disease: qres = acacia.query( """ PREFIX tst: <http://www.semanticweb.org/aalviian/ontologies/2017/1/untitled-ontology-10#> SELECT ?disease ?patogen WHERE { ?disease tst:caused_by ?patogen . FILTER regex(str(?disease), "%s") . } """ % id_disease ) for row in qres: for r in row: print(r.replace('http://www.semanticweb.org/aalviian/ontologies/2017/1/untitled-ontology-10#','')) print("\n") Output: penyakit_tepung spaerotheca_sp penyakit_tepung oidium_sp penyakit_tepung erysiphe_sp hawar_daun cylindrocladium_sp hawar_daun kirramyces_sp hawar_daun phaeophleopspora_sp Expected Array : [['spaeerotheca_sp','oidium_sp','erysiphe_sp'].['cylindrocladium_sp','kirramyces_sp','phaeophleopspora_sp']] Please, help me if you know how step to get it. -
Django Single File 404
I'm a beginner in Django and I have put all my static files (html, css, js) in the static-only folder. This works fine, the template shows up neatly. However, I recently added a custom.css file and it's showing a 404 on python manage.py runserver. The other files in the same folder don't show a 404, however this does. I've typed the href path correctly and have rechecked again and again, but the error persists. Even collectstatic doesn't help. -
how could I use Model._meta.get.fields() to read all fields in my model
I am new to django and learning slowly. I am wanted to display some fields and I know I could do it by as follows : In my admin.py class AuthorAdmin(admin.ModelAdmin): list_display = ('last_name', 'first_name', 'last_name', 'date_of_birth' ) fields = [('first_name' ,'last_name'), 'date_of_birth'] pass admin.site.register(Author, AuthorAdmin) Unfortunately my tables has many fields and I do not want to write them individually. I found that ._meta.get.fields() could read all fields. However, I can not get it correct. It is as follows >> In my admin.py : admin.site.register(PersonLogin) admin.site.register(LoginHistory) class PersonAdmin(admin.ModelAdmin): list_display = [field.name for field in Person._meta.get_fields() if not field.primary_key] readonly_fields = ('person_id',) pass admin.site.register(Person, PersonAdmin) it says that _meta is undefined variable. Could some one help me ? Latest django in use. Thank you in advance. PG -
Remove trailing data from django timesince -- template equivalent
What is the Django template equivalent to this?: timesince(value).split(", ")[0] I have a use case where I can't using templatetags. In my templatetag, I would do something like this: @register.filter def custom_timesince(value): return timesince(value).split(", ")[0] How would I go about doing this in my Django HTML template without using a templatetag? My variable in the django template is: {{datetime_obj}} -
how to get output using django query postgresql
Table : Demo ID Name Score 1 A 10 2 B 5 3 B 2 4 A 12 5 A 5 i have created the above table with data. Now i need to get the output like below Name Name_count Name_score A 3 27 B 2 7 Anyone help me to do with django query -
Django user signup by Ajax request
I am new to web development and I m trying to signup a user by using ajax call. I m looking for "status":"ok" in the response for removing overlay and changing the login option with the user profile option. But i m getting this response from django backend which is -: html: "{"status": "ok", "html": "\n <div class=\"notification\">\n <span><a>Notifications</a></span>\n <div class=\"count_pop\"></div>\n <div class=\"not_pop not\">\n\n\n <div>\n\n <a href=\"/see_all/\"target=\"_blank\">See all notifications</a>\n </div>\n <ul>\n\n </ul>\n </div>\n\n </div>\n\n\n <div class=\"user_profile\">\n <picture> \n <img src=\"/media/2017/03/default_profile_pic.png\"/>\n </picture>\n <a>ab cd</a>\n <div class=\"user_pop\">\n <ul>\n <li><a href=\"/user/abcd\">Profile</a></li>\n <li><a href=\"/accounts/password/change/\">Change Password</a></li>\n <li><a href=\"/user/settings/\">Settings</a></li>\n <li><a href=\"/logout/\">Logout</a></li>\n </ul>\n </div>\n </div>\n\n </div>", "user": {"id": 105, "name": "ab cd"}, "next": "/"}" how can I get "status": "ok" ? -
Django default login view always populates the next field
I'm using the default django authentication system with little customization. The core functionality to login and logout is working as expected. The problem is with the following snippet in my login form template: {% if next %} <p>Please login to see this page.</p> {% endif %} This is adapted from the example login view provided in the official documentation. The idea is that if the user tried to access a protected page without logging in, he/she would be redirected to the login page and the next parameter is set to the protected page's url. This is working fine. However, when the user clicks on the login url and navigates directly to the login url, the above error message should not be displayed. But in this case, the next parameter is being set to the LOGIN_REDIRECT_URL from settings.py and we see this error message. I tried to debug to find where the problem is, and found it in django.contrib.auth.views.LoginView class. This class has a method get_success_url which gets the redirect url either from the next parameter or from the LOGIN_REDIRECT_URL. This method is being used to populate the context for the login form in the method get_context_data, which, in my opinion … -
How can I contain more than 2 models in one template?
I'm student who studying Django myself. I will brief my project simply. Get baseball players' record Display it in my website My project complete is within hailing distance. But I have a problem. This is my view.py from django.shortcuts import get_object_or_404, render from displayer.models import Profile, SeasonRecord def index(request): profile_list = Profile.objects.all().order_by('-no')[:5] context = {'profile_list': profile_list} return render(request, 'displayer/index.html', context) def data(request, profile_id): profile = get_object_or_404(Profile, pk=profile_id) season = SeasonRecord.objects.all().order_by('-no')[:5] context = {'profile': profile, 'season':season} return render(request, 'displayer/data.html', context) I want to contain 2 models (Profile, SeasonRecord) in view function(data) and I am going to contain more models in this view function. But It contains only Profile model. This is urls.py from django.conf.urls import url from django.contrib import admin from displayer import views urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^displayer/$', views.index, name='index'), url(r'^displayer/(?P<profile_id>\d+)/$', views.data, name='data'), ] This is data.html <h1>{{ profile.number }}</h1> <h1>{{ profile.name }}</h1> <table align="left" border="1"> <tr> <td>position</td> <td>debut</td> <td>born</td> <td>body</td> </tr> <tr> <td>{{ profile.position }}</td> <td>{{ profile.debut }}</td> <td>{{ profile.born }}</td> <td>{{ profile.body }}</td> </tr> </table> <br/><br/><br/><br/><br/> <table align="left" border="1"> <tr> <td>avg</td> <td>rbi</td> </tr> <tr> <td>{{ season.avg }}</td> <td>{{ season.rbi }}</td> </tr> </table> Help me.. What should I do? I'm using django version 1.10.5, python version 3.5.2 -
Distributed Celery tasks workers and concurrency database writes limitations (postgresql)
I'm doing a Django/Celery app, with each worker running on multiples Docker containers, all have access to the database, the task that each one run is an execution of the ansible command. It will run a plabook and when the task finish will log to database data about the command (this is do it in a callback plugin). While I have tested the app only in my computer with small number of workers, I know that databases have limitations on writes, and I don't know what will happend when multiples workers try to write to the same database and table (create or updates). What will be the best architecture to do concurrency and parallel writes to postgresql? -
What command can allow me to recreate the django_admin_log table?
I deleted that table (whoops), and now I'd like to regenerate it. Is there a command that allows me to do that? Looking online, everyone is saying to use the command ./manage.py syncdb, but that command is no longer available in the most recent version of Django. So I tried ./manage.py migrate, but that didn't generate the table. I also tried ./manage.py --run-syncdb, but that didn't do it either. I'm pretty sure I can do it by hand, but I'm hoping there's a way to do this with a built-in command. -
AttributeError: (Class) object has no attribute '__name__' Creating ModelForms [Django & Python2.7]
This is my first time using Django and I am completely stuck at how to use ModelForms in my project. I have been able to follow the online tutorials this far but without ModelForms(to add data into a Postgresql database), I can't proceed onward. I am trying to simply make a form page that lets the users add a few inputs (2 datefields and 1 textfield) and by submitting that form, the data will be added to the database. The error I have been getting is: AttributeError: 'Hyuga_Requests' object has no attribute 'name' [where Hyuga_Request is a class set in the models.py] models.py from __future__ import unicode_literals from django.db import models from django.forms import ModelForm class Hyuga_Requests(models.Model): name = models.CharField(max_length=50) s_date = models.DateField(auto_now=True) e_date = models.DateField(auto_now=True) reason = models.TextField(max_length=500) def __unicode__(self): return self.name views.py from django.shortcuts import render from django import forms from .forms import Hyuga_RequestForm def create_req(request): form = Hyuga_RequestForm() context = {"form":form,} return render(request,"request_form/requestform.html", context) forms.py from django import forms from .models import Hyuga_Requests from django.forms import ModelForm class Hyuga_RequestForm(forms.ModelForm): class Meta: model = Hyuga_Requests() fields = ['name','s_date','e_date','reason'] Please help this noobie... -
Custom JSON callback using Django Rest Framework
I'm just trying to write a mobile app using https://jasonette.com/, but it wants backend specific JSON format for an each response, something like below: { "$jason": { "head": { "title": "{ ˃̵̑ᴥ˂̵̑}", "actions": { "$foreground": { "type": "$reload" }, "$pull": { "type": "$reload" } } }, "body": { "header": { "style": { "background": "#ffffff" } For test purposes I serialised regular django_user model: class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('id', 'username', 'first_name', 'last_name', 'email') And it returns a JSON-object with a user list. But how I can customize this JSON with additional values and format it as a Jasonette wants? -
is there an easy way to update a **kwarg while querying? django
I have a function like this...which helps me with code re-writing when calling out a query def user_profile(self, **kwargs): default_fields = { 'is_deleted': False, 'is_staff': False, 'is_active': False } kwargs.update(default_fields) return Profile.objects.filter(**kwargs) but let's say, if I don't want to add another new parameter into the function and I want to override the is_staff field sometimes *maybe out of 20 queries only 1 need is_staff: True. Is an easy way? I have thought of adding another parameter into the function to detect if True / False something like that which would work. But I wonder if there's an even easier faster way to do this? Thanks in advance for any suggestions. -
How to cross reference based on foreign keys? Django
I have a Django app where a traveller 'requests' a local to take him out on an excursion. After they have gone out, they leave a reference for each other to mention whether they had fun and some written description. On the homepage I want to automatically feature the last two requests where both the traveller and the local have already met AND left a reference for each other. Currently data comes from population script. This is the Request model: class Request(models.Model): """traveler requests local to take her out upon liking her profile""" traveler = models.ForeignKey(User, related_name='traveler_requests') local = models.ForeignKey(User, related_name='local_requested') message = models.CharField(max_length=500) date = models.DateField()#date of excursion local_approval = models.BooleanField(blank=True) This is the Reference model: class Reference(models.Model): author = models.ForeignKey(User, related_name='referencer')#can be local or traveler referenced = models.ForeignKey(User, related_name='referencee')#can be local or traveler description = models.CharField(max_length=500, default="default reference") fun = models.BooleanField() #did you have fun with the person or not? date = models.DateField(default=datetime.datetime.now())#in order to pull the last ref on index page local = models.BooleanField(default=True) #Is the author a local ? This is my attempt at achieving what what I want: reqs = Request.objects.filter(local_approval=True).order_by('-date')[:2] for i in range(len(reqs)): local_references_traveler = Reference.objects.filter(fun=True, author=reqs[i].local, referenced=reqs[i].traveler, local=True).latest() traveler_references_local = Reference.objects.filter(fun=True, author=reqs[i].traveler, … -
In Django, how to render static/base.html file on browser?
I've changed settings.py as follows. import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DEBUG = True TEMPLATE_DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'mytweets.urls' STATICFILES_DIRS = [ os.path.join( os.path.dirname(__file__), 'static', ), ] TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ BASE_DIR + '/templates/' ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], 'loaders': ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ), }, },] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } ... STATIC_URL = '/static/' I have changed views.py file as follows. from __future__ import unicode_literals from django.shortcuts import render from django.http import HttpResponse from django.views.generic import View class Index(View): def get(self, request): return HttpResponse('I am called from a get Request') def post(self, request): return HttpResponse('I am called from a post Request') Then I have changed url.py file as follows. from django.conf.urls import patterns, include, url from django.contrib import admin from tweets.views import Index admin.autodiscover() urlpatterns = [ url(r'^$', Index.as_view()), url(r'^admin/', include(admin.site.urls)), ] Finally I have made base.html file. {% load staticfiles %} <html> <head> <title>Django</title> <link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.min.css' %}" media="screen"> </head> <body> {% block content … -
Related objects as separate endpoint (the "edge" model) using Django Rest Framework
Background I'm trying to figure out how to build an API where endpoints can have additional "edges" that can be used to look up related objects, rather than including those related objects (or their pks) in the endpoint of the "master" object itself. This can be handy when there are a lot of related objects, since including the related objects in the response for the master object would be expensive. Some examples of this style of API are the GitHub API and the Facebook Graph API: /repos/:owner/:repo/issues => gets a list of issues related to the repo /v2.9/{photo-id}/likes => gets a list of likes related to the photo Example In the contrived example below I would have thought that a list_route in the ViewSet could be used to build this sort of relationship, but instead it creates a url of the form /repos/issues/ instead of /repos/{pk}/issues/. If I change it to detail_route it leaves the {pk} in the URL, but that seems like an abuse of detail_route since that's really meant to return a single object, right? class Repo(models.Model): name = models.TextField() class Issue(models.Model): title = models.TextField() body = models.TextField() repo = models.ForeignKey(Repo) class RepoSerializer(serializers.ModelSerializer): class Meta: model = Repo … -
Does memcached get refreshed between each test in Django?
from django.test import TestCase from django.core.cache import cache class SampleTest(TestCase): def test_cache_set(self): cache.set('test_key', 'test_value', 100) def test_cache_get(self): self.assertEqual(cache.get('test_key'), 'test_value') A simple example as before. The reason I am asking this question is not because I'd like to do such a test since I know tests are supposed to be independent from each other. I am asking this because I am debugging some other code, and I doubt it is because memcache is not refreshed between tests. Honestly, I cannot even use the example above since I do not even know the order of testing :) Tests are supposed to be independent, but I do not know if memcache that tests use are independent as well. -
In Django, how to include template folder I have created with the base file named base.html on settings.py?
I have been learning Django for a week, but I'm not sure how to include template folder I have created with the base file named base.html on settings.py file. In order to do that, I have changed settings.py file at the end of the code as follows. TEMPLATE_DIRS = ( BASE_DIR + '/templates/' ) TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) In settings.py file, there is already TEMPLATES looks like as follows. TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, },] When I run python manage.py runserver, the exception occurs. Traceback (most recent call last): File "manage.py", line 22, in execute_from_command_line(sys.argv) File "/usr/lib/python2.7/dist-packages/django/core/management/init.py", line 354, in execute_from_command_line utility.execute() ... File "/usr/lib/python2.7/dist-packages/django/conf/init.py", line 108, in init "Please fix your settings." % setting) django.core.exceptions.ImproperlyConfigured: The TEMPLATE_DIRS setting must be a tuple. Please fix your settings. I think that TEMPLATES include TEMPLATE_DIRS & TEMPLATE_LOADERS. BUT I'm not sure. How can I handle it? -
Filtering a queryset issue in view django
I apologise in advance as im still new to django and I've inherited this projects. i currently have this views.py def home(request): if request.user.is_authenticated(): location = request.GET.get('location', request.user.profile.location) users = User.objects.filter(profile__location=location) print (users) matches = Match.objects.get_matches_with_percent(request.user) print (matches) I get a list of users from matching app in "matches = " like this from the print (matches) [[<User: lucy>, '79.00%'], [<User: newuser>, '70.71%'],...... and i get a list of users from the "users =" like this from print (users) [<User: jonsnow>, <User: newuser>]...... how do i filter matches down to the users that come through, i tried adding a .filter(User=users) on the end of "matches =" however i got this error "'list' object has no attribute 'filter'". I really hope this makes some sense i do apologise if I've explained my self very badly here, and thank you in advance for any help. -
What's wrong in my Gunicorn upscript file?
This is my Gunicorn Upscript file in DigitalOcean. I am using Ubuntu 14.04 as Droplet. But gunicorn is not starting. description "gunicorn server handling ipac website" start on runlevel [2345] stop on runlevel [!2345] respawn setuid root setgid www-data chdir /var/www/ipaccorporation.com/ipac-corporation exec /var/www/ipaccorporation.com/ipac-corporation/env/bin/gunicorn --workers 3 --bind unix:/var/www/ipaccorporation.com/ipac-corporation/ipac/ipac.sock ipac.wsgi:application Error: ImportError: No module named 'ipac' Project Structure -
TypeError: %d format: a number is required, not datetime.timedelta
Here is the code and the Traceback : @staff_member_required @require_http_methods(['POST']) def fax_contract(request, pk=None): if request.is_ajax() and pk: print("Sending contract for request {}".format(pk)) try: contract = Contract.objects.get(pk=pk) except Contract.DoesNotExist: return HttpResponseNotFound(_('Contract not found')) now = datetime.datetime.now() last_faxed = contract.request.last_faxed_at if last_faxed and (now - last_faxed) < settings.LOANWOLF_FAX_GRACE_TIME: return JsonResponse({ 'error': True, 'reload': False, 'message': _('Please wait at least %(minutes)d minutes to resend the contracts') % { 'minutes': settings.LOANWOLF_FAX_GRACE_TIME}, }) else: contract.request.last_faxed_at = datetime.datetime.now() contract.request.save() subject, msg = ('', '') # TODO: audit log try: send_mail = send_mail(subject, msg, settings.LOANWOLF_FAX_EMAIL_FROM, settings.LOANWOLF_FAX_EMAIL_TO.format(contract.request.customerprofile.fax), fail_silently=False) return JsonResponse({'success': True, 'reload': True}) except Exception as e: return JsonResponse({'error': True, 'message': str(e)}) and Traceback (most recent call last): File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__ return self.application(environ, start_response) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in __call__ response = self.get_response(request) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response response = self._middleware_chain(request) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = response_for_exception(request, exc) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 86, in response_for_exception response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info()) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 128, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django_extensions/management/technical_response.py", line 6, in null_technical_500_response six.reraise(exc_type, exc_value, tb) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 39, in inner response = get_response(request) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response response = self._get_response(request) File "/home/jeremie/Projects/24-django/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response …