Blog Posts

Most Popular Blog Tags

Mocking ASGI Scope in WSGI Requests when Testing Django Async Views

Django channels are great for asynchronous views, but they can be a headache to test. This is due to the incompatibility with database transactions and all the side effects that the incompatibility produces. For example, the common pattern of rolling back the database after tests does not work, the data remains there which makes other tests fail as test outputs become flaky.

Deploying a Django Channels ASGI Server to Kubernetes

Django channels is great for adding support of various network protocols as WebSockets, chat protocols, IoT protocols and other. It’s a great way to add real-time functionality to your Django application. To use channels however, requires you to deploy an ASGI server in production. This is a bit more complex and there are multiple flavors of ASGI servers to choose from. In this blog post I’ll show you how to deploy Django channels with Daphne and Nginx in a Kubernetes environment.

Adding a Shell to the Django Admin

Django’s admin is an amazing batteries-included addition to the Django framework. It’s a great tool for managing your data, and it is easily extendable and customizable. The same goes for Django’s ./manage.py shell command. If we were to combine these two give then it would have a great outcome, a fully interactive Django shell where you can manage your data in the admin. This was the idea behind django-admin-shellx, a Django application that provides a shell in the admin interface.

Shynet