Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
how to redirect any api request from http to https in django?
after migrating my django web app from http to https, when i type for example r= requests.get('http://xxxx.com') it gives me this error : requests.exceptions.SSLError: HTTPSConnectionPool(host=my_host_name,port:443) Max retries exceeded with url:http://xxxx.com (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)) but i made the nginx config for the redirection for example when i put any http address on my browser it redirects me to the correct https address. i would like to do the same thing on the api request . i don't like to change my requests adresses on my backend code i just want to redirect the http requests to https if it is possible? -
how can I send an email to user when admin change a value from admin panel
I want to send an email to the user when his/her post has to approve/reject. class Post(models.Model): POST_STATUS = ( ('approve', 'approve'), ('pending', 'pending'), ('reject', 'reject') ) user = models.ForeignKey(User, on_delete=models.CASCADE) category = models.ForeignKey(Category, on_delete=models.CASCADE) status = models.CharField(max_length=10, choices=POST_STATUS, default='pending') #title, body, image will be here -
error with django.core.exceptions.ImproperlyConfigured: on Django 2.2.5
I know that this question has been asked before and I went through every possible answers given, and it still does not make it for me! I am running django 2.2.5 and python 3.7 on PyCharm. My manage.py seems to be working fine. The issue is coming from my admin file, I believe but I do not know where the issue could be. I ran django-admin check in terminal which also give me an error. My only file that raise an error is my admin.py but I cannot understand why. I copied my admin.py file as well as the errors that I get when I write the commands on the terminal from django.contrib import admin from import_export.admin import ImportExportModelAdmin from inventory1.templates.models import * @admin.register(Item) class ViewAdmin(ImportExportModelAdmin): exclude= ('id',) And when I execute it, I get the error: raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. Now, I am sure this is related too, when I try django-admin check, i get: django.core.exceptions.ImproperlyConfigured: Requested setting TEMPLATES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. from previous questions, this issue was coming from an issue with settings in the manage.py … -
How do I properly use a UUID id as a url parameter in Django?
I've been trying to pass a UUID4 id into the url for a specific detail page. After browsing Stackoverflow and other sites, here's what I've tried so far: Passing the url path as path('car/<uuid:id>/', views.CarDetailView.as_view(), name='car-detail'), But this raises the error: Generic detail view CarDetailView must be called with either an object pk or a slug in the URLconf.. Since the uuid field is composed of both letters and numbers, I can't use an int. So I used this: path(r"^(?P<car_model>\w+)/$", views.CarDetailView.as_view(), name='car-detail'), which returns the messy and broken url: showroom/%5E(%3FP09c32f72-5863-49fa-a42a-1d0fed274c4e%5Cw+)/$ Then I tried reverting to the original, but using a def_object method in the View class. def get_object(self): object = get_object_or_404(CarInstance,title=self.kwargs['car_model']) return object But this returns the error: "KeyError at /showroom/car/09c32f72-5863-49fa-a42a-1d0fed274c4e/ 'car_model'" models.py class CarInstance(models.Model): manufacturer = models.ForeignKey('Manufacturer', on_delete=models.SET_NULL, null=True) car_model = models.CharField('Model', max_length=50, null=True) views.py class CarDetailView(generic.DetailView): model = CarInstance template_name = 'car_detail' def get_queryset(self): return CarInstance.objects.all() def get_object(self): object = get_object_or_404(CarInstance,title=self.kwargs['car_model']) return object def get_absolute_url(self): return reverse('showroom:car-detail', args=[str(self.pk)]) The urls should be be formatted as showroom/car/09c32f72-5863-49fa-a42a-1d0fed274c4e/, which brings up the detail view for the specific object. Any ideas? -
filter a modelform based on a column not in that form
I have a model for users like: class user: name = models.CharField([...]) mobile = models.CharField([...]) and for its manager I have: [...] ManagerColumn('name', 3), ManagerColumn('last_order_date', 3, is_variable=True) [...] def get_last_order_date(): [some function returning date data type] now I want to filter this manager modelform based in last_order_date which is not in original model. how can I do that? -
How to distinguish 1 optional parameter and 1st function name in Django
Following urls are valid: //localhost/ //localhost/123 //localhost/hello/ //localhost/hello/456 url.py url(r'^$', views1.custom1, name='custom1'), url(r'^(?P<param1>.+)/$', views1.custom1, name='custom1'), url(r'^hello/$’, views2.custom2, name='custom2’), url(r'^hello/(?P<param2>.+)/$', views2.custom2, name='custom2’), view1.py def custom1(request, param1=''): view2.py def custom2(request, param2=''): For url //localhost/hello/, custom1() function responds, with param1='hello' which is not correct! Following 2 url can’t be distinguished. url(r'^(?P<param1>.+)/$', views1.custom1, name='custom1'), url(r'^hello/$’, views2.custom2, name='custom2’), How to fix it? -
TemplateDoesNotExist at /edit-narration/13/edit/
Why is my narrate_update_form template not showing? And why am I getting TemplateDoesNotExist at /narration/7/edit/ narrate_update_form My views.py is: class NarrateUpdate(UpdateView): model = Narrate fields = ['title', 'body'] template_name = 'narrate_update_form' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['narrate'] = Narrate.objects.get(pk=self.kwargs['pk']) return context On my narrate template I have this button: <a href="{% url 'edit-narration' narrate.pk %}" value="Update">Edit/Update</a> On the narrate_update_form.html, I have: {% extends 'base.html' %} {% block body %} <form method="post">{% csrf_token %} {{ form.as_p }} <input type="submit" value="Update"> </form> {% endblock body %} Can anyone help me? -
name 'TEMPLATE_DIR' is not defined
i am trying to create Templates for the views, but when i trying to runserver it says NameError: name'TEMPLATE_DIR' is not defined i have tried to look in google and forums, but that didn't solve my problem i created templates in the base directory and add the route to the template directory TEMPLATES_DIR = os.path.join(BASE_DIR,'templates') and added TEMPLATE_DIRS in the DIRS 'DIRS': [TEMPLATE_DIR], NameError: name 'TEMPLATE_DIR' is not defined -
Subpages created via admin disappears in menu
I'm creating subpages using admin panel. Then I'm using loop to add them to main menu. They are displayed only on home page. If I switch to one of them they no longer show up in menu (same happen with languages prefixes). so lets say we have home.html with menu: home | about | createdsubpage1 | createdsubpage2 | EN | DE | PL then I go to 'createdsubpage1' or any other page and in menu left only: home | about some views: def index(request, *args, **kwargs): multilanguage = Multilanguage.objects.all() sub_links = Subpage.objects.all() return render(request, 'home.html', {'multilanguage':multilanguage, 'sub_links':sub_links}) def generated_page(request, slug): unique_subpage = get_object_or_404(Subpage, slug=slug) sub = Subpage.objects.get(slug=slug) if sub.is_active: context = { 'unique_subpage': unique_subpage, } return render(request, 'subpage.html', context) else: return render(request, '404.html', {'sub':sub}) app url: urlpatterns = [ path('', views.index, name='index'), path('o-nas', views.about, name='about'), path('oferta', views.offer, name='offer'), path('kontakt', views.contact, name='contact'), path('subpage', views.subpage, name='subpage'), path('<slug:slug>', views.generated_page, name='generated_page'), ] header.html: <ul id="nav-mobile" class="right hide-on-med-and-down"> <li><a href="{% url 'index' %}">{% trans 'Strona główna' %}</a></li> <li><a href="{% url 'offer' %}">{% trans 'Oferta' %}</a></li> <li><a href="{% url 'about' %}">{% trans 'O Nas' %}</a></li> {% for sub in sub_links %} {% if sub.is_active %} <li><a href="{% url 'generated_page' sub.slug %}">{% trans sub.title %}</a></li> {% endif … -
How to get those subcategories to show on main categories?
I'm very new to django and I'm making a ecommerce website. I'm trying to have subcategories for my products so I assigned each product with subcategories and the subcategory have parent_category. However I'm have trouble getting all products of the parent category to show. Can you help me out please class Category(models.Model): name = models.CharField(max_length=50) slug = models.SlugField(unique = True) parent_category = models.ForeignKey('self', null=True, blank=True,on_delete=models.DO_NOTHING) def list_of_post_by_category(request,category_slug): maincat = [] subcat = [] categories = Category.objects.all() obj = Product_info.objects.filter() if category_slug: category = get_object_or_404(Category, slug=category_slug) obj = obj.filter(category=category) for c in categories: if c.parent_category == None: maincat.append(c) elif c.parent_category == category: subcat.append(c) context = {"category":maincat,"subcategory":subcat,"obj_list":obj,"showcat":category} return render(request,'cat.html',context) -
Django models for social media apps ValueError in ManyToManyField
I am building a social media apps. This is my models: from django.db import models class Person(models.Model): name = models.CharField(max_length=50) class Group(models.Model): admin = models.ManyToManyField(Person, related_name='admin') members = models.ManyToManyField(Person, blank=True, related_name='members') def save(self, *args, **kwargs): self.members.add(self.admin) super(Group, self).save(*args, **kwargs) When i try to create new group, it throws me following error because of overriding save method.. ValueError at /admin/social/group/add/ "<Group: Group object (None)>" needs to have a value for field "id" before this many-to-many relationship can be used. I want an admin of a group also will be a members of the same group, that is why i override the save method but it throws me above errors. Also i tried to achieve this with Django signal like below @receiver(post_save, sender=Group) def make_admin_also_members(sender, instance, created, **kwargs): if created: instance.members.add(instance.admin) instance.save() and it throws me following error: TypeError at /admin/social/group/add/ int() argument must be a string, a bytes-like object or a number, not 'ManyRelatedManager' then i try achieve it like this: @receiver(post_save, sender=Group) def make_admin_also_members(sender, instance, created, **kwargs): if created: instance.members.add(str(instance.admin)) instance.save() it throws me following error: ValueError at /admin/social/group/add/ invalid literal for int() with base 10: 'social.Person.None' After i got above error, i tried to achieve this like below @receiver(post_save, … -
"Back button" problem with AJAX form post on a multi-page site
In my Django project I have a page with a table of devices and a form to add a new device. And now I want to translate that form post to AJAX. I've done this with a help of jQuery Form Plugin (http://malsup.github.com/jquery.form.js): $('#deviceAddForm').ajaxForm({ dataType: 'json', async: true, cache: false, success: function (data) { device_row = '<tr>' + '<td>' + data['name'] + '</td>' + '<td>' + data['description'] + '</td>' + '</tr>'; $(device_row).hide().appendTo($('#deviceTableBody')).show("slow") } }); And now I have a browser "back button" problem. If a user posts some devices, goes to different site and then back (through browser back button) additional AJAX content is not displayed. This problem is usual to AJAX, and all of the solutions, that I've found refer to History API. When AJAX content is updated there should be history.pushState call, and browser back/forward buttons should be handled through window.onpopstate event. Maybe I am missing something, but this way seems to work only if a user travels only on one particular single page application site (SPA). If a user goes, for example, to Google and back onpopstate event will not fire (HTML5 History API: "popstate" not called when navigating back from another page). So this doesn't seem … -
Django Updating A one To Many Array
So I get this error Direct assignment to the reverse side of a related set is prohibited. Use emails.set() instead. This is how my code looks like class Client(models.Model): class Email(models.Model): client = models.ForeignKey(Client, on_delete=models.CASCADE, related_name='emails', null=True, blank=True) email = models.CharField(null=True, blank=True, max_length=50) class EmailSerializer(serializers.ModelSerializer): class Meta: model = Emailfields = '__all__' class ClientSerializer(serializers.ModelSerializer): emails = EmailSerializer(required=False, allow_null=True, many=True) def update(self, instance, validated_data): # Update all fields of Client. [setattr(instance, k, v) for k, v in validated_data.items()] instance.save() return instance So the client can have many emails. When update is called, it says Direct assignment to the reverse side of a related set is prohibited. Use emails.set() instead. This error message can be avoided by removing the emails from the validated_data via let emailsData = validated_data.pop('emails', []). but once done, im not sure what to do next in order to update the emails array if it needs updating, or deleting it if it is not in the emailsData array anymore. Thoughts? -
How to save a qr code image as a model field in Django
I want to add a qr code image field to my 'Person' model. The data of the qr code will come from the user_id and will store its profile page – for example, user 1234 will have the qr code that contains siteurl.com/1234. I began by creating the image field, but I am not sure as to where to go from there. Any help would be appreciated! Models: from django.db import models import uuid class Person(models.Model): user_id = models.UUIDField( primary_key=True, default=uuid.uuid4, editable=False ) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) email = models.EmailField() number_of_guests = models.PositiveIntegerField() qrcode_image = models.ImageField( upload_to='qr_code_images', blank=True, null=True ) def __str__(self): return " ".join([self.first_name, self.last_name, str(self.user_id)]) -
Django: How do I show formatted number with thousands separator correctly?
I am trying to show formatted number with thousands separator like '123,456,789', but with below code it doesn't show as desired at html. How should I correct this? The below does work but it shows like '123456789 EUR' views.py class ScatterView(TemplateView) : def get(self, request, *args, **kwargs) : context = super().get_context_data(**kwargs) context['price'] = str(plots.get_price()).format() return render(request, 'index.html', context) index.html {{ price }} EUR -
How to save textarea data when click outside the textarea using ajax
I am using froala editor and i want text in text area of editor saved when user clicks outside that textarea using Ajax i am new in ajax id of content editor is #id_content This is my form part in django <form method="POST" id="froala_form" class="PageForm _inputHolder"> {% csrf_token %} <div class="_alignRight posR _saveBTNOut"> <button type="submit" class="_btn btnPrimery">Save as Draft</button> This is what i have tried but not getting any proper logic function loadDoc(){ var xhttp=new XMLHttpRequest(); xhttp.onreadystatechange=function{ if(this.readyState==4 && this.status==200){ var x = document.getElementById("id_content"); x.addEventListener("click", ajaxsavefunc); } }; xhttp.open("GET",'url', true); xhttp.send(); } function ajaxsavefunc(xhttp) { document.getElementById("froala_form").innerHTML = editor.html.get() } -
Django JSONField versus normal fields
i want to store statistics of game (online games) which method should i use Does using JSONField have a performance impact, and what problems can it cause in the future? class Statistics(models.Model): game=models.Foreignkey data=JSONField() { "team1": { "rank": 25, "point": "10", "assists": 25, "prize": 4, "name": "TeamName", "players": { "top": { "items": [ { "id": 1, "name": "aa" }, null, { "id": 2, "name": "bb" }, { "id": 5,... OR class Statistics(models.Model): game=models.Foreignkey rank=models.SmallIntegerField() point=models.SmallIntegerField() and more... -
Should I divide a table by OneToOneField if the number of columns is too many?
I have a student model that already has too many fields including the name, nationality, address, language, travel history, etc of the student. It is as below: class Student(Model): user = OneToOneField(CustomUser, on_delete=CASCADE) # Two many other fields A student has much more information I store in other tables with a OneToOne relationship with the student model such as: class StudentIelts(Model): student = OneToOneField(Student, on_delete=CASCADE) has_ielts = BooleanField(default=False,) # 8 other fields for IELTS including the scores and the date and file field for uploading the IELTS result # I have other models for Toefl, GMAT, GRE, etc that # are related to the student model in the same manner through a OneToOne relationship Should I merge the tables into one table or the current database schema is good? The reason I chose this schema was that I was not comfortable working with a table with two many columns. The point is that for every student, there should be a table for IELTS and other models and, as a result, the number of rows in Student table is the same as the number of rows in the IELTS table, as an example. -
How to get views.py variables into <script> code django
I'm creating a chatbot using html template and django. I am able to get user input from html to views.py but when I'm unable to send the output to the same html. I have tried giving {{output}} in the script tag. But didn't work. My chatbox.html code including jquery: <html> <body> <form action="/chatbot/" method="post"> {% csrf_token %} <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script type="text/javascript"> $(document).on("keypress", "input", function(e){ if(e.which == 13){ var inputVal = $(this).val(); document.getElementById("myTextarea").innerHTML += '\nMe: '+inputVal+'\n'); var outputVal = '{{output}}' || false; function printText(){ document.getElementById("myTextarea").innerHTML += '\nBot: '+outputVal +'\n'; } setTimeout(printText,500); } }); </script> <textarea id="myTextarea" rows="30", cols="60", name="text-area">Hi dude! Welcome to Chat Bot</textarea> <input id='myInput' name="utext" placeholder="Ask Something..." type="text"> </form> </body> </html> My views.py file: from django.shortcuts import render, HttpResponse def get_input(request): print(request.POST) input = request.POST.get('utext',False) print("input:",input) output = "Hello! How are you doing?" return render(request, "chatbox.html", {'output': output}) Hi dude! Welcome to PIP Bot Me: hi Bot: Hello! How are you doing? This is the expected output from this view. -
How to check last login in django template?
Here I am trying to display user online if the user is currently logged in the site else I want to display the last login in with timesince .But I got stuck while checking if the user is currently logged in or not in the site. How can I check it ? templates {{user.username}} <small class="sidetitle" style="color:red;"> {% if user.currently_logged_in %}Online {% else %} seen {{user.last_login|timesince}} ago{% endif %} </small> -
Include custom URL prefix for languages in Django
I am trying to include the country codes as well while implementing django language translation apart from the usual language codes like en and ar which would be appended to the url's. I am trying to acheive something like this https://docs.djangoproject.com/uae/1.10/howto/ # this will be English by default https://docs.djangoproject.com/uae-ar/1.10/howto/ # this will be Arabic https://docs.djangoproject.com/uae-fr/1.10/howto/ # this will be French Below is my settings file variables LANGUAGE_CODE = 'en-us' LANGUAGES = ( ('en', _('English')), ('uae-ar', _('Arabic')), ('uae-fr', _('French')), ) I would like to know the best practice of implementing this method. Please do let me know if I am missing out on anything here. -
How to Make username field case insensitive in Dnago? Is my Implementation right?
I am in starting of my web project using Django and Django Rest Framework. I wanted my username field to be case Insensitive and hence I searched web about how to achieve it and got to this beautiful blog: https://simpleisbetterthancomplex.com/tutorial/2017/02/06/how-to-implement-case-insensitive-username.html. He suggested this method: from django.contrib.auth.models import AbstractUser, UserManager class CustomUserManager(UserManager): def get_by_natural_key(self, username): case_insensitive_username_field = '{}__iexact'.format(self.model.USERNAME_FIELD) return self.get(**{case_insensitive_username_field: username}) class CustomUser(AbstractUser): objects = CustomUserManager() for models.py But when I wrote tests, they were failing because User.objects.get_by_natural_key was returning two user objects when I created two users with same username, but different case (ex: 'aniket' and 'Aniket'). So, I got through this approach : from django.contrib.auth.models import UserManager, AbstractUser # Create your models here. class CustomUserManager(UserManager): def create_user(self, username, email=None, password=None, **extra_fields): return super().create_user(username.lower(),email,password,**extra_fields) def create_superuser(self, username, email, password, **extra_fields): return super().create_superuser(username.lower(),email,password,**extra_fields) def get_by_natural_key(self, username): case_insensitive_username_field = '{}__iexact'.format(self.model.USERNAME_FIELD) return self.get(**{case_insensitive_username_field: username}) class User(AbstractUser): objects = CustomUserManager() So, is this approach up to the mark? -
Manually displaying formset forms as a table in Django
I am trying to create an inline formset displaying form fields as a header table (for header data) and then the item data as a child table. Header data is displayed as expected but I am stuck at the child data (refer the image). I have so far done this (as shown below): models.py class MaterialTyp(models.Model): material_type_id = models.CharField(primary_key=True, max_length=4, verbose_name='Material Type') material_type_desc = models.CharField(max_length=100, verbose_name='Material Type Desc') def __str__(self): return '{0}-{1}'.format(self.material_type_id, self.material_type_desc) class PurchOrder(models.Model): PO_Number = models.IntegerField(primary_key=True, max_length=10, unique=True, verbose_name='PO Number') po_doc_type = models.CharField(max_length=2, null=True, default='PO', verbose_name='Doc Type') po_date = models.DateTimeField(default=datetime.now, null=True, verbose_name='PO date') po_closed = models.BooleanField(default=False, verbose_name='Close PO') def __str__(self): return '{0}'.format(self.PO_Number) class PurchOrderItem(models.Model): po_item_num = models.AutoField(primary_key=True, verbose_name='Line Item Number') hdr_po_num = models.ForeignKey(PurchOrder, on_delete=models.CASCADE, null=True, verbose_name='PO Number') po_itm_matl_type = models.ForeignKey('MaterialTyp', on_delete=models.SET_NULL, null=True, verbose_name='Matl Type') po_itm_split_allowed = models.BooleanField(default=False, verbose_name='Split?') def __str__(self): return '{0}'.format(self.po_item_num) forms.py class CreatePoForm(forms.ModelForm): class Meta: model = PurchOrder fields = ('po_doc_type', 'po_date', 'po_closed') widgets = { 'po_doc_type': forms.TextInput(attrs={'readonly': 'readonly', 'style': 'width:60px; background:lightgrey'}), } class CreatePoItemForm(forms.ModelForm): class Meta: model = PurchOrderItem fields = ('po_item_num', 'po_itm_matl_type', 'po_itm_split_allowed') CreatePoFormset = inlineformset_factory( PurchOrder, PurchOrderItem, form = CreatePoItemForm, can_delete=True, min_num=0, validate_min=True, max_num=100, extra=1, ) views.py def create_dynamic_po(request, object_id=False): template_name = "pudding/purchorder_create_dyna.html" if object_id: fresh_form = PurchOrder.objects.get(pk=object_id) else: fresh_form = PurchOrder() if … -
Django: Accessing variables in class-based views
I'm setting up a website with a fairly basic users system where you can do the usual stuff like login, change your password etc. I'm using an example Django project and changing it a bit here and there. When the user is logged in I am able to access the user's email address and put it into the page by adding this to the template {{ request.user.email }}. But in a link emailed to user to reset their password where the user is not logged in the same thing doesn't work. I'm guessing it must be possible to access it somehow though. This is the class view that I'm using: class RestorePasswordConfirmView(PasswordResetConfirmView): template_name = 'accounts/restore_password_confirm.html' def form_valid(self, form): form.save() messages.success(self.request, _('Your password has been set. You may go ahead and log in now.')) return redirect('/') def get_context_data(self, **kwargs): context = super(RestorePasswordConfirmView, self).get_context_data(**kwargs) context = {**context, **host_(self.request)} return context Is there any way to access the user.email variable? -
Need help in emailing errors
I can't seem to get my errors emailed, It gets logged successfully but no email gets sent! There is no traceback or any other errors, just that if an error code 500 is encountered, it logs it but doesn't send any email to the admins! I have tried many solutions on the internet and none have worked! Here is a part of my settings.py: ADMINS = [('Prithvi', '<email1>')] #Email Settings MAILER_LIST = ['<email1>'] EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_HOST = '<email2>' EMAIL_HOST_PASSWORD = '<password>' EMAIL_USE_TLS = True EMAIL_USE_SSL = False EMAIL_USE_LOCALTIME = True SERVER_EMAIL = '<email2>' DEFAULT_FROM_EMAIL = '<email2>' #Logger and Handler settings # Python logging package import logging # Standard instance of a logger with __name__ stdlogger = logging.getLogger(__name__) # Custom instance logging with explicit name dbalogger = logging.getLogger('dba') LOGGING = { 'version': 1, 'disable_existing_loggers': True, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse', }, 'require_debug_true': { '()': 'django.utils.log.RequireDebugTrue', }, }, 'formatters': { 'simple': { 'format': '[%(asctime)s] %(levelname)s %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S' }, 'verbose': { 'format': '[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S' }, }, 'handlers': { 'console': { 'level': 'DEBUG', 'filters': ['require_debug_true'], 'class': 'logging.StreamHandler', 'formatter': 'simple' }, 'development_logfile': { 'level': 'DEBUG', 'filters': ['require_debug_true'], 'class': 'logging.FileHandler', 'filename': …