Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
PyCon tutorials, day one
11:39: This morning’s tutorial was on the OpenAPI specification, née Swagger. I wasn’t satisfied with this one. Much of it was a series of, “Look at X. Now make the changes in your file that are like X,” exercises. At times it was almost pattern-matching in nature. I wish it had spent more time delving under the covers. However, I extracted some useful nuggets of information. In previous jobs, my teams have used Django Rest Framework for the API implementation and django-rest-swagger to generate live documentation. Time-consuming, “now you have two problems,” issues were always encountered. Django Rest Framework is a framework in and of itself, and so it’s a framework wrapping another framework. Add in django-rest-swagger and you almost have three frameworks, with multiple points of impedance mismatch to each other. (This is understandable. It’s amazing it all works as well as it does.) The process of keeping it all happy took time, and the end results were problematic. In at least two instances, my team chose to lower the API’s quality in order to keep using DRF. One pain point was nested parameters; they (particularly modifiable ones) were extraordinarily painful. So, back to the tutorial. Coffee Meets Bagel’s … -
Using Python and Google Docs to Build Books
When I started my latest fiction book, The Darkest Autumn, I wrote out the chapters as individual files. I did it in a text editor (Sublime) and saved the files to a git repo. The names of the files determined their order, chapters being named in this pattern: the-darkest-autumn $ tree . ├── 01_Beginnings.md ├── 02_Town_of_Ravenna.md ├── 03_Walls_of_Ravenna.md As the book developed I thought about moving it to Scrivener. If you don't know, Scrivener is an excellent tool for writing. It encourages you to break up your work into chapters and scenes. The downside is that Scrivener is complex (I want to write, not figure out software) and Scrivener isn't designed for simultaneous collaboration. The latter issue is a very serious problem, as I like to have others review and comment on my writing as I go. What I really wanted to do is combine the chapter breaking of Scrivener with the simplicity and collaboration of Google Docs. Preferably, I would put the book chapters into Google Docs as individual files and then send invites to my editor, wife, and my beta readers. By using Google Docs I could ensure anyone could access the work without having to create a … -
Using Python and Google Docs to Build Books
When I started my latest fiction book, The Darkest Autumn, I wrote out the chapters as individual files. I did it in a text editor (Sublime) and saved the files to a git repo. The names of the files determined their order, chapters being named in this pattern: the-darkest-autumn $ tree . ├── 01_Beginnings.md ├── 02_Town_of_Ravenna.md ├── 03_Walls_of_Ravenna.md As the book developed I thought about moving it to Scrivener. If you don't know, Scrivener is an excellent tool for writing. It encourages you to break up your work into chapters and scenes. The downside is that Scrivener is complex (I want to write, not figure out software) and Scrivener isn't designed for simultaneous collaboration. The latter issue is a very serious problem, as I like to have others review and comment on my writing as I go. What I really wanted to do is combine the chapter breaking of Scrivener with the simplicity and collaboration of Google Docs. Preferably, I would put the book chapters into Google Docs as individual files and then send invites to my editor, wife, and my beta readers. By using Google Docs I could ensure anyone could access the work without having to create a … -
Runtime Permissions in Android: The What, Why, and How
It’s great if you are dealing with an application from a famous and well-known developer whom you can trust. But imagine that you want to install a music player that requires, let’s say, information about your location. It looks very suspicious, doesn’t it? The post Runtime Permissions in Android: The What, Why, and How appeared first on Distillery. -
Kubernetes Health Checks in Django
Kubernetes Health Checks in Django -
Django and nginx file proxy - part one
In this blog post series, I will show you how to use Nginx for hiding download urls. Django will serve us as a backend. Let's go! In this series I will build simple web application - user upload a file via api and then she/he wants to download it. But … -
Fastest Redis configuration for Django
I have an app that does a lot of Redis queries. It all runs in AWS with ElastiCache Redis. Due to the nature of the app, it stores really large hash tables in Redis. The application then depends on querying Redis for these. The question is; What is the best configuration possible for the fastest service possible? Note! Last month I wrote Fastest cache backend possible for Django which looked at comparing Redis against Memcache. Might be an interesting read too if you're not sold on Redis. Options All options are variations on the compressor, serializer and parser which are things you can override in django-redis. All have an effect on the performance. Even compression, for if the number of bytes between Redis and the application is smaller, then it should have better network throughput. Without further ado, here are the variations: CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": config('REDIS_LOCATION', 'redis://127.0.0.1:6379') + '/0', "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", } }, "json": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": config('REDIS_LOCATION', 'redis://127.0.0.1:6379') + '/1', "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", "SERIALIZER": "django_redis.serializers.json.JSONSerializer", } }, "ujson": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": config('REDIS_LOCATION', 'redis://127.0.0.1:6379') + '/2', "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", "SERIALIZER": "fastestcache.ujson_serializer.UJSONSerializer", } }, "msgpack": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": config('REDIS_LOCATION', … -
Distillery QA Team Makes the Finals in the 2nd Open EU Championship as They Prepare for the Grand Final in Poland
The Distillery Quality Assurance team competed in the 2nd Open European Championship for Web and Mobile Specialists and made it to the finals! Anna Varetsa, QA Manager, and Ekaterina Golubeva, QA Specialist, excelled at solving the different challenges presented by Jury Board, a selection of highly qualified and experienced industry professionals. The results were revealed on April 28th, after two weeks of nervously waiting for the outcome. The post Distillery QA Team Makes the Finals in the 2nd Open EU Championship as They Prepare for the Grand Final in Poland appeared first on Distillery. -
Django Version Viewer Announcement
Presenting a new open source plugin: The Django Version Viewer! Imaginary Landscape is pleased to present a helpful new plugin for the Django Web Framework - The Django Version Viewer! If you find yourself frequently switching between projects or perhaps looking at a codebase you haven’t seen in some time, it’s often useful to know the contents of the project’s virtual environment. Typically this information is only accessible either by examining your project’s requirements.txt (which may or may not accurately reflect what is installed in your environment) or by accessing your app’s server directly to examine the app’s virtual environment. The Django Version Viewer is a handy tool that exposes this information in a handful of ways: Through the Django Admin panel The plugin conveniently exposes a link at the top of your admin index pane to expose a simple drop down listing all of your project dependencies. Through a DjangoCMS Toolbar Menu Item If Django CMS is installed, a new menu item will be added to the CMS Toolbar Page Menu that will allow opening the version viewer popup. Through an API call Alternatively, you can make a request to a URL at www.yourAppsDomain/django_version_viewer to retrieve a list of … -
Django and working with large database tables
The slides from my presentation for the Django Stockholm Meetup group. Contains small comparison between MySQL and PostgreSQL in terms of performance when modigying the tables structure. Django and working with large database tables from Ilian Iliev -
A simple Python email gateway
Say you have a Django web application that you want to integrate with emails to make it possibile to send data and files to your web application over SMTP. The good news is that Python has a simple SMTP daemon in the standard library, together with modules to parse emails. Let’s see how to create a simple email gateway on top of these tools. Using the following Python module you can setup a simple pure Python email server on port 25, parse the incoming emails and make a multipart/form-data POST HTTP request to your web application. You’ll need the awesome Requests library for the HTTP request to work. In a production environment you can setup supervisor to launch your simple SMTP server. With a simple configuration like this: [program:smtp_server] command = /home/ubuntu/.virtualenvs/venv/bin/python /home/ubuntu/mail_gateway/smtp_server.py user = root Then try to send an email to your server, if the server public IP has been associated to a DNS record yourserver.example.com you can use something like test@yourserver.example.com as a recipient, and you should see the incoming email in the logs. Have fun with emails! -
A simple Python email gateway
Say you have a Django web application that you want to integrate with emails to make it possibile to send data and files to your web application over SMTP. The good news is that Python has a simple SMTP daemon in the standard library, together with modules to parse emails. Let’s see how to create a simple email gateway on top of these tools. Using the following Python module you can setup a simple pure Python email server on port 25, parse the incoming emails and make a multipart/form-data POST HTTP request to your web application. You’ll need the awesome Requests library for the HTTP request to work. https://gist.github.com/baxeico/d5d6f855774ba9f72e11909648a46cae In a production environment you can setup supervisor to launch your simple SMTP server. With a simple configuration like this: [program:smtp_server] command = /home/ubuntu/.virtualenvs/venv/bin/python /home/ubuntu/mail_gateway/smtp_server.py user = root Then try to send an email to your server, if the server public IP has been associated to a DNS record yourserver.example.com you can use something like test@yourserver.example.com as a recipient, and you should see the incoming email in the logs. Have fun with emails! The post A simple Python email gateway appeared first on Augusto Destrero - Freelance developer and sysadmin. -
A simple Python email gateway
Say you have a Django web application that you want to integrate with emails to make it possibile to send data and files to your web application over SMTP. The good news is that Python has a simple SMTP daemon in the standard library, together with modules to parse emails. Let’s see how to create a simple email gateway on top of these tools. Using the following Python module you can setup a simple pure Python email server on port 25, parse the incoming emails and make a multipart/form-data POST HTTP request to your web application. You’ll need the awesome Requests library for the HTTP request to work. import smtpd import asyncore import logging import email from email.header import decode_header import requests logger = logging.getLogger(__name__) class CustomSMTPServer(smtpd.SMTPServer): def process_message(self, peer, mailfrom, rcpttos, data): try: logger.debug('Receiving message from: %s:%d' % peer) logger.debug('Message addressed from: %s' % mailfrom) logger.debug('Message addressed to: %s' % str(rcpttos)) msg = email.message_from_string(data) subject = '' for encoded_string, charset in decode_header(msg.get('Subject')): try: if charset is not None: subject += encoded_string.decode(charset) else: subject += encoded_string except: logger.exception('Error reading part of subject: %s charset %s' % (encoded_string, charset)) logger.debug('Subject: %s' % subject) text_parts = [] attachments = {} logger.debug('Headers: %s' … -
Bundling and Minifying CSS & JS in Django
Bundling and minifying CSS and JavaScript in Django cuts requests and bytes for better Core Web Vitals. Here's the modern 2026 pipeline — Vite via django-vite, webpack via django-webpack-loader, and collectstatic with ManifestStaticFilesStorage plus WhiteNoise — with config snippets for Django 5.x. -
How to Use Nested Formsets in Django
Django has no built-in nested formset. Learn how to nest an inline formset inside each parent form in Django 5.x — handling unique prefixes, the per-row management_form, validation, and saving parents before children. -
Convert XML to JSON in Python with xmltodict
A practical 2026 guide to converting XML to JSON in Python with xmltodict: parse XML into a dict, serialize with json.dumps(), handle attributes and namespaces, stream large files, round-trip back to XML, and parse untrusted XML safely. -
What's Great About Django Girls: Inspiring Women Into Programming
Django Girls is a volunteer-run non-profit that hosts free, beginner-friendly one-day Django and Python workshops worldwide, backed by a famous free online tutorial. Here is what it is, why it matters for women in tech, and how to attend, organise, or sponsor a workshop in 2026. -
Django deployments without downtime
This post describes a deployment and maintenance method for Django projects that was designed with scalability in mind. The goal is to push new releases into production at any moment with minimal or no downtime. Upgrades can be performed with unprivileged access to the production server, and rollbacks are possible. I use Gunicorn, Fabric and Supervisord in the examples. -
Stable Django deployments without downtime
This post describes a deployment and maintenance method for Django projects that was designed with scalability in mind. The goal is to push new releases into production at any moment with minimal or no downtime. Upgrades can be performed with unprivileged access to the production server, and rollbacks are possible. I use Gunicorn, Fabric and Supervisord in the examples. -
Machine learning empowered blackkiwi
A blackkiwi which tells your mood. Blackkiwi is a django powered website which uses machine learning to tell if you wrote happy or sad things on your latest Facebook status. And it tends to be wayyy positive. But we will get there… The genesis of blackkiwi There were two main things combined with the genesis of blackkiwi. The first it was this curiosity about Natural Text processing and classificaiton techniques. In particular I wanted to write some classifers to see how well they were performing and I also wanted to try to do and test something new. But I needed some kind of application. This is usually a good trick in programming in general. If you build towards something, it is always easier to stay motivated and actually getting it done, instead of giving up the hobby and end up playing World of tanks on the play :). The second ingredient was to try to test the release process via gitlab, using automatic push via CI to a server. As stack I wanted to use a classic dokku stack which I’m very happy to use, beccause it basically brings the nice and easy way to deploy similar to heroku/gondor style … -
Django REST framework (DRF) with Angular 2+ tutorial (Part 1)
This is the first part of a tutorial series about getting started with Django framework and Angular 2 . The final objective is to create a restful web application which has two separate parts .The first part is the back end which is created with Django and the Django REST framework ,the second part is the front end which is built using Angular 2+ framework . Django REST framework (DRF) with Angular 2+ tutorial (Part 1) Django REST framework (DRF) with Angular 2+ tutorial (Part 2) Django REST framework (DRF) with Angular 2+ tutorial (Part 3) We are going to use Django 1.11 ,Django REST framework 3.6.2 and Angular 2+ . Before starting ,this tutorial has a bunch of development requirements : You need to have Python installed and configured PIP and Virtualenv installed Node.js and Angular 2 CLI installed Objectives of the part 1 In the first part of these tutorial series ,we are going to cover basic introductions to the two server side used frameworks Django and DRF ,and their initial setup . Getting started with Django and DRF . The custom project anatomy and structure (front end and back end) Getting started with Django and DRF Django … -
Django REST framework (DRF) and Angular 2 tutorial (Part 1)
This is the first part of a tutorial series about getting started with Django framework and Angular 2 . The final objective is to create a restful web application which has two separate parts .The first part is the back end which is created with Django and the Django REST framework ,the second part is the front end which is built using Angular 2 framework . We are going to use Django 1.11 ,Django REST framework 3.6.2 and Angular 2 . Before starting ,this tutorial has a bunch of development requirements : You need to have Python installed and configured PIP and Virtualenv installed Node.js and Angular 2 CLI installed Objectives of the part 1 In the first part of these tutorial series ,we are going to cover basic introductions to the two server side used frameworks Django and DRF ,and their initial setup . Getting started with Django and DRF . The custom project anatomy and structure (front end and back end) Getting started with Django and DRF Django is a web framework based on Python which allows developers to quickly prototype and build web applications .It has a powerful ORM that abstracts how you can interact with popular … -
Make More Room: How to Resolve Database Record Limitations
Sometimes in the process of designing a database, developers can underestimate the scope of a project. If that project were to become successful, it would result in significant loads and put undue strain on the system and it’s developers down the line. Eventually, people realize that they are using an INT identity key with a maximum value of 2,147,483,647 as the primary key of a huge table. The post Make More Room: How to Resolve Database Record Limitations appeared first on Distillery. -
Django efficient implementation of Amazon s3 and Cloufront CDN for faster loading.
Django by default to store the files in your local file system. To make your files load quickly and secure we need to go for any third party storage systems. AWS s3 is one of the storage service for the Internet. It is designed to make web-scale computing easier for developers. django has a package called django-storages which can be used to store the files in the amazon s3. and serve them from its cloud front service. Implementing django-storages with amazon s3 as storage service in your django application: To implment django-storages in your django application you need to follow the following steps. 1. Install django-storages: We can install django-storages with the following command. pip install django-storages 2. Keep storages in your installed apps. INSTALLED_APPS = ( ... 'storages', ... ) 3. Change your DEFAULT_FILE_STORAGE setting in your settings.py file: Django by default comes with a setting called DEFAULT_FILE_STORAGE which deals with file storage. By default its value is 'django.core.files.storage.FileSystemStorage'. By keeping this value to DEFAULT_FILE_STORAGE, django, by default tries to store the files on your local machine. To store your files in amazon s3 just change that value to 'storages.backends.s3boto3.S3Boto3Storage' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' 4. Configure your AWS ACCESS_KEY … -
Python Memcached Implementation for Django project
A fundamental trade-off in dynamic websites is they’re dynamic. Every time a user requests a page, the Web server fetches data from database then applies logic and renders in templates. This will affect page load time due to time taken by server to fetch data and apply the business logic, That’s where caching comes in. To cache something is to save the result of an expensive calculation so that you don’t have to perform the calculation next time. In This Blog Post, Lets see how to use Memcached for server-side application caching. Memcached is an in-memory key-value pair store, that helps in caching dynamic websites. Django uses python-memcached binding for communication between our web application and Memcached Server. apt-get install memcached #to install memcached-server pip install python-memcached Add the following settings to settings.py or django settings CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': 'unix:/tmp/memcached.sock', } } Now you're all set use caching. from django.core.cache import cache cache.set(cache_key, result, cache_time) # to cache a value cache.set_many({'a': 1, 'b': 2, 'c': 3}) # to cache many keys cache.get(cache_key) # to retive a key from cache cache.get_many(['a', 'b', 'c']) # to retrive many keys from cache To use as Decorator: from django.views.decorators.cache import …