Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django News - 2020 Year-in-Review - Jan 1st 2021
Introduction 2020 in Review Thanks to all of our newsletter subscribers. We grew to over 1,500 readers and an average open rate of 63%+ which is considered very high for newsletters. We're looking forward to 2021 and continuing to provide news, articles, and projects in the Django community. django-news.com News 2020 Malcolm Tredinnick Memorial Prize awarded to Ken Whitesell Ken Whitesell was awarded the 2020 Malcolm Tredinnick Memorial Prize for his many contributions to the Django community. This year we received the highest number of nominations ever received for the Malcolm Tredinnick Memorial Price with some being nominated twice, three times, and the highest being six times. djangoproject.com Channels security release issued: 3.0.3 Channels 3.0.3 is a security release and we encourage all users of Channels to upgrade as soon as possible. djangoproject.com Django News newsletter sponsorship If you'd like to reach 1,500+ engaged Django developers with news, projects, job listings, and more consider sponsoring our newsletter. Rates and availability are all online. django-news.com Articles Django Best Practices: Security The most-clicked article was by Will on Security, providing a list of top factors to consider in any Django project and tips for locking-down security. learndjango.com Docker & Django local development: … -
Customer Docs - Building SaaS #85
In this episode, I integrated customer documentation into the app. I showed how to build Sphinx documentation into a Django project, then created a help view to link to the docs. Finally, I added documentation building to the deployment process. I previously created a Sphinx documentation project to hold docs for my app, but I had not hooked the docs into my project yet. Before hooking it in, I explained how Sphinx works and how I customized the documentation to fit with my project. -
Continuous Delivery in an Agile World
This article looks at what Continuous Delivery is, why it's a competitive advantage, and what the process looks like. -
AI is catching up to the hype
One of the major trends I’ve been thinking about a lot this year is that the reality of AI has starting catching up to the hype. This thought has been percolating in my brain for a while, and finally bubbled out into a comment on MetaFilter. I’m publishing it here, as well. -
Django News - GeoDjango and Hotwire! - Dec 24th 2020
News Python Release Python 3.8.7 Python 3.8.7 is a bugfix release. python.org Hotwire: HTML Over The Wire Hotwire is an alternative approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over the wire. The Basecamp folks put up a marketing website announcing some new OSS tools which promote sending HTML instead of JSON over the wire. hotwire.dev Django Backend Support for Hotwire Discussion If you are curious about how to use Hotwire with Django, checkout this discussion. hotwire.dev Events PyCon Us 2021 Call for Proposals is Open! PyCon US 2021 will be virtual but the call for proposals is open now until February 12, 2021. blogspot.com Articles Creating Custom Postgres Data Types in Django Some tips on creating new data types in Postgres and bringing them into a Django application. pganalyze.com How to Mock the Current Date and Time in Python by Adam Johnson If you’re testing Python code that relies on the current date or time, you will probably want to mock time to test different scenarios but doing so isn't that easy. Adam Johnson shares some tips on how to overcome this. adamj.eu Learn about ghapi, a new third-party Python client … -
Web Authentication Methods Compared
This article looks at the most commonly used web authentication methods. -
Search & GeoDjango - Paolo Melchiorre
Paolo’s personal website20tabGithub profileTwitter profileDjangoCon Europe 2020 - A Pythonic Full-Text SearchDjangoCon Europe 2019 - Maps with GeoDjango, PostGIS and LeafletFull-Text Search in Django with PostgreSQLWorld Food ProgramMaps with Django (part 1): GeoDjango, SpatiaLite and LeafletSupport the ShowThis podcast is a labor of love and does not have any ads or sponsors. To support the show, consider purchasing or recommending a book from LearnDjango.com or signing up for the free weekly Django News newsletter. -
Refactoring Enrollment - Building SaaS #84
In this episode, I decided to redesign a portion of the application flow. I wasn’t pleased with how users would enroll students for their grades so I refactored the school year page into a flow that worked better. Note: My internet connection was not good during this stream. Thankfully, the audio is fine and reading code is very possible because the background doesn’t need to change much. My apologies for the low quality. -
Django Chat - E81
A podcast on the Django Web Framework by William Vincent and Carlton Gibson. -
Testing Django with Cypress, how nice!
When I discovered Cypress in 2017 my life as a developer changed. I was not afraid to write functional tests anymore, and since then I applied this tool to any web framework I worked with. In particular, I've been working almost exclusively with Django these days, and even if JavaScript does not fare so well in Python developers circle, when it comes to testing a Django/JavaScript project my tool of choice is always Cypress. In this post I share a couple of recipes for testing Django with Cypress, with a focus on the authentication flow. Testing Django login with Cypress As suggested in the Cypress documentation, you may want to test the authentication flow of a web application no more than once with the UI. This means you create a single test somewhere, where you check your login page: describe("Login", () => { before(() => { cy.fixture("users.json").as("mockedUsers"); }); it("Can login through the UI", function () { cy.visit("/login/"); cy.get("input[name='username']").type(this.mockedUsers[0].fields.email); cy.get("input[name='password']").type("dummy_password"); cy.get("form").submit(); cy.getCookie("sessionid").should("exist"); }); }); As for the fixtures, you can use the same data from Django dumpdata, aply saved in cypress/fixtures/fixture_name.json. Testing Django login without the UI So far so good for the first login test. What if you now need … -
RobotFramework, Chromedriver and Docker
One of my team implemented [RobotFramework](https://robotframework.org) support for automated browser testing of our platform a while ago. At the time, we were using [Codeship](https://codeship.com) Basic, and I built a [helper](https://schinckel.net/2020/05/27/django-and-robot-framework/) to run a robot test suite within a tox environment. It was all good, because `chromedriver` and all it's dependencies were already installed. But time passes, and we needed to move to Codeship Pro. Which has some neater features, but required me to build docker images for everything. We already use docker for deployment, but I didn't really want to build a bunch of distinct images just for testing that re-implemented the same stuff that we have in our deployment images. Even just appending new stuff to them means that things could turn out to be a pain in the arse to manage. And getting chromedriver installed into a docker image is not neat. I did find a [docker image that just has an instance of chromedriver](https://github.com/RobCherry/docker-chromedriver/blob/master/Dockerfile), and exposes that. But getting that to work with robot was still a bunch of work. After much experimentation, I was able to get the connections between everything to work. First, we need to have the chromedriver container running: {% highlight bash %} … -
RobotFramework, Chromedriver and Docker
One of my team implemented [RobotFramework](https://robotframework.org) support for automated browser testing of our platform a while ago. At the time, we were using [Codeship](https://codeship.com) Basic, and I built a [helper](https://schinckel.net/2020/05/27/django-and-robot-framework/) to run a robot test suite within a tox environment. It was all good, because `chromedriver` and all it's dependencies were already installed. But time passes, and we needed to move to Codeship Pro. Which has some neater features, but required me to build docker images for everything. We already use docker for deployment, but I didn't really want to build a bunch of distinct images just for testing that re-implemented the same stuff that we have in our deployment images. Even just appending new stuff to them means that things could turn out to be a pain in the arse to manage. And getting chromedriver installed into a docker image is not neat. I did find a [docker image that just has an instance of chromedriver](https://github.com/RobCherry/docker-chromedriver/blob/master/Dockerfile), and exposes that. But getting that to work with robot was still a bunch of work. After much experimentation, I was able to get the connections between everything to work. First, we need to have the chromedriver container running: {% highlight bash %} … -
Update value only if present
We have a bunch of integrations with external systems, and in most of these cases we are unable to use Oauth, or other mechanisms that don't require us to store a username password pair. So, we have to store that information (encrypted, because we need to use the value, rather than just being able to store a hashed value to compare an incoming value with). Because this data is sensitive, we do not want to show this value to the user, but we do need to allow them to change it. As such, we end up with a form that usually contains a username and a password field, and sometimes a URL field: {% highlight python %} class ConfigForm(forms.ModelForm): class Meta: model = ExternalSystem fields = ('username', 'password', 'url') {% endhighlight %} But this would show the password to the user. We don't want to do that, but we do want to allow them to include a new password if it has changed. In the past, I've done this on a per-form basis by overridding the `clean_password` method: {% highlight python %} class ConfigForm(forms.ModelForm): class Meta: model = ExternalSystem fields = ('username', 'password', 'url') def clean_password(self): return self.cleaned_data.get('password') or self.instance.password … -
Update value only if present
We have a bunch of integrations with external systems, and in most of these cases we are unable to use Oauth, or other mechanisms that don't require us to store a username password pair. So, we have to store that information (encrypted, because we need to use the value, rather than just being able to store a hashed value to compare an incoming value with). Because this data is sensitive, we do not want to show this value to the user, but we do need to allow them to change it. As such, we end up with a form that usually contains a username and a password field, and sometimes a URL field: {% highlight python %} class ConfigForm(forms.ModelForm): class Meta: model = ExternalSystem fields = ('username', 'password', 'url') {% endhighlight %} But this would show the password to the user. We don't want to do that, but we do want to allow them to include a new password if it has changed. In the past, I've done this on a per-form basis by overridding the `clean_password` method: {% highlight python %} class ConfigForm(forms.ModelForm): class Meta: model = ExternalSystem fields = ('username', 'password', 'url') def clean_password(self): return self.cleaned_data.get('password') or self.instance.password … -
Django News - Wagtail in the news - Dec 18th 2020
News Announcing the Location for PyCon US 2022/2023 PyCon US 2022 and 2023 will be in Salt Lake City, Utah. blogspot.com Wagtail 2.11.3 release notes Wagtail 2.11.3 includes four bug fixes and one upgrade consideration to look at before you upgrade. wagtail.io Events Wagtail Documentation Sprint We're running a two-day sprint, focused on Wagtail's documentation, and we'd love you to come. It will be on January 7th and 8th 2021 and will take place in Torchbox's offices in the UK (depending on what's safe by then), as well as remotely. google.com Articles Django Session-based Auth for Single Page Apps A look at how to authenticate Single-Page Applications (SPAs) with Django session-based authentication. Suitable for a frontend built with React/Vue/Angular/etc. testdriven.io Introducing django-version-checks by Adam Johnson Notes on the recently released django-version-checks package and why it came to be. adamj.eu 12 Days of Performance by REVSYS An oldie but a goodie. revsys.com Understanding Django: Middleware Do You Go? Another in Matt Layman's series on Understand Django, this is a deep look at middleware. mattlayman.com Useful Flake8 Plugins for Python Linting This is a nice introduction to Flake8 and many useful plugins. dev.to Design Articles Pattern Lab goes Django Torchbox recently released … -
Empty States - Building SaaS #83
In this episode, I returned to the onboarding flow and start to polish some of the extra pages. We filled the pages with special copy and a call to action to each page to help customers be successful. I started with the pages that displays the school years. We added a chunk of template from the onboarding process that asks the user to create a school year. I modified the template chunk to make it fit in the context of the page. -
Why is the Django Framework Suitable for Web Development?
Choosing a web development framework is challenging. But for most companies, the Django web framework is a popular choice. It is versatile, powerful, and supports Machine Learning development. A Django web development company builds scalable applications for enterprises of all shapes and sizes. The Django framework architecture... The post Why is the Django Framework Suitable for Web Development? appeared first on BoTree Technologies. -
Middleware Do You Go?
In the previous Understand Django article, we covered the built-in auth system. That article gave you a chance to see the User model, ways to login users with Django’s authentication tools, and the features that make the authorization controls work. In that topic, middleware came up as an integral component. Now we’re going to learn more about middleware and its function within a Django project. From Browser To DjangoURLs Lead The WayViews On ViewsTemplates For User InterfacesUser Interaction With FormsStore Data With ModelsAdminister All The ThingsAnatomy Of An ApplicationUser AuthenticationMiddleware Do You Go? -
Django Session-based Auth for Single Page Apps
This article looks at how to add session-based authentication to a Single-Page Application (SPA) powered by Django and React. -
Wagtail modeladmin and a dynamic panels list
Wagtail has the modeladmin module in contrib which allows you to edit any Django model through the Wagtail admin interface. Unfortunately it's not very flexible, the code calls the get_edit_handler method on the admin class and the panels property of the model can only be a list. In one project I have a base model that many other models are derived from and wanted to build the panels dynamically. The code below shows how I did it. I chose to break the Wagtail convention and defined the admin fields on the admin class, but I get the additional fields from the model itself. It's somewhat messy, but it's my mess. Raw from wagtail.admin.edit_handlers import FieldPanel from wagtail.admin.edit_handlers import MultiFieldPanel from wagtail.admin.edit_handlers import ObjectList from wagtail.contrib.modeladmin.options import ModelAdmin class DynamicPanelMixin: def get_edit_handler(self, instance, request): return ObjectList(self._get_panels(instance)) def _get_panels(self, instance): return [ *self._get_head_panels(instance), MultiFieldPanel( self._get_multi_panels(instance), heading="Collapsed", classname="collapsible collapsed", ), ] def _get_head_panels(self, instance): panels = [ FieldPanel("foo"), ] return panels + getattr(instance, "head_panels", []) def _get_multi_panels(self, instance): panels = [ FieldPanel("bar"), ] return panels + getattr(instance, "multi_panels", []) # class MyModelAdmin(DynamicPanelMixin, ModelAdmin): # pass -
Introducing django-version-checks
It can be tricky to ensure all the environments that your project runs on use the same versions of Python, PostgreSQL, and other external dependencies. Often development, CI, and cloud environments have different configuration systems, making them hard to keep in sync. And coordinating between all your team members to upgrade their local environments can be complicated, as upgrade emails or instant messages get forgotten if they are away on holiday, working on other projects, etc. And using the wrong versions of external dependencies can lead to hard-to-debug errors, wasting time to find such a simple fix. I’ve solved this problem several times on different projects over the years with custom Django system checks. These can tell you early in Django’s startup process the environment has the incorrect versions. Today I’ve released a package containing configurable versions of such checks, django-version-checks. You activate the checks by specifying the allowed versions in PEP 440 specifiers, the same format that pip uses.s For example, imagine you are using the cutting-edge versions of Python and MariaDB. To ensure all environments use these versions, or compatible bug fix releases, you can install django-version-checks and add this to your settings file: VERSION_CHECKS = { "mysql": … -
Django News - Issue 53 - Dec 11th 2020
News 2021 DSF Board Election Results Thank you to our outgoing DSF Board Members: Frank Wiles (President), James Bennett (Secretary), and Sayantika Banik. We appreciate your years of service to the community. The 2021 returning Board of Directors are Anna Makarudze (Vice President/President-elect), William Vincent (Treasurer), Kátia Nakamura, and Aaron Bassett. New board members are Žan Anderle, Mfon Eti-mfon, and Chaim Kirby. djangoproject.com Wagtail 3rd Party Packages A new dedicated home for Wagtail 3rd party packages. Learn more in the official blog post documenting the move. wagtail.io Python 3.9.1 is now available, together with 3.10.0a3 and 3.8.7rc1 Python 3.9.1 is the first version of Python to support macOS 11 Big Sur natively on Apple Silicon. blogspot.com Python Software Foundation News: Announcing the PSF Diversity and Inclusion Work Group blogspot.com Events PyCascades Grant application opens! If you would like to attend the conference but do not have the funds to purchase a ticket, the application deadline is December 19, 2020 (AoE). pycascades.com Articles Exhaustiveness Checking with Mypy by Haki Benita Haki Benita walks us through exhaustiveness checking with mypy. hakibenita.com How To Set Up Tailwind CSS In Django On Heroku A step-by-step guide to configuring Tailwind on a Heroku-hosted Django app. … -
Introducing django-linear-migrations
If you’ve used Django migrations for a while, you may be familiar with this message: $ python manage.py migrate CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0002_longer_titles, 0002_author_nicknames). To fix them run 'python manage.py makemigrations --merge' This appears when the migration history for one of your apps branched to have two “leaf nodes”, that is, two final migrations. The simplest example has our first initial migration, then two conflicting second migrations: +--> 0002_author_nicknames / 0001_initial +--| \ +--> 0002_longer_titles This happens quite naturally when developing two features for same app, both with migrations. The solution Django suggests is to create a merge migration with makemigrations --merge. This creates another migration in our history that depends on the last two: +--> 0002_author_nicknames +-+ / \ 0001_initial +--| |--> 0003_merge \ / +--> 0002_longer_titles +----+ This merge migration tells Django “it’s fine to run both branches of migrations and end up here”. This is a simple solution, and avoids modification of the exisiting migrations. But it has a number of drawbacks. First, it’s a fix after the fact. You need to encounter the “Conflicting migrations detected” error before you step in and create the merge migration. This is … -
Customer Feedback - Building SaaS #82
In this episode, I worked on feedback from my primary customer. We fixed a couple of issues that she reported, then moved on to more of the onboarding flow. Before getting to the code, we chatted about ways to learn to code. I linked to a popular book, Automate the Boring Stuff with Python, and some good web tutorials for learning Django. The first bit of customer feedback that I worked on was to add a back link from a course details to get a user back to the grade level that holds the course. -
Jazzband - Matthias Kestenholz
Matthias’s Personal SiteJazzband on GitHubfeincms may still be relevantOfficial Django MerchandiseFeinheitMatthias on Githubfeincms3Official Django merchandiseSupport the ShowThis podcast is a labor of love and does not have any ads or sponsors. To support the show, consider purchasing or recommending a book from LearnDjango.com or signing up for the free weekly Django News newsletter.