Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Introducing Tight.ai - My First Desktop App
I just released a production-g... -
Django Best Practices: Referencing the User Model
Django has a powerful, built-in [user authentication system](https://docs.djangoproject.com/en/4.0/topics/auth/default/) that makes it quick and easy to add [login, logout, and signup functionality](https://learndjango.com/tutorials/django-login-and-logout-tutorial) to a website. But how should a Django developer … -
Flask Stripe Tutorial
This tutorial looks at how to quickly add Stripe to a Flask app in order to accept payments. -
Django News - Django Technical Board Election - Aug 28th 2020
News Announcement of Technical Board Election Registration There is an upcoming Django Technical Board election. All current DSF Members are automatically registered for this election. If you are not a DSF Member but would like to vote in this election there is a form to fill out. djangoproject.com Black 20.8b1 Pre-release of the latest version of Black, the opinionated Python formatter. github.com Wagtail 2.10.1 release notes Bugfix release for the lastest major Wagtail version. wagtail.io GitHub Changelog: Set the default branch for newly-created repositories GitHub now allows you to change your default branch name for newly-created repositories. PSA: On October 1, 2020, GitHub is changing the default from master to main. github.blog Events PyCon AU / DjangoCon AU 2020 - Sept. 4th – 6th, 2020 PyConline AU and DjangoCon AU are one week away! pycon.org.au Articles Administer All the Things The next in a series by Matt Layman, this in-depth tutorial focuses on the Django admin. mattlayman.com Python Tools for Managing Virtual Environments A comprehensive look at the multiple ways to manage Python virtual environments. dev.to Test Elasticsearch in Django Without Mocking Use Django and pytest to test Elasticsearch without mocking. yanglinzhao.com Tutorials Deploying a Production-ready Django app on AWS … -
Authenticating Google Client Library for a Django Application
Recently I was tasked with integrating Google Sheets with Django. It was necessary for a row to be added to a Google Sheet on completion of a user action. Having no experience with interacting with Google Sheets programmatically, a quick search found me the Google Sheets API V4 Python Quickstart Guide. Remember: I needed to append a row a Google sheet on behalf of the application NOT the user. OAuth I followed the quickstart guide and was able to create a functioning application that was able to add a row to Google Sheets. However as I simply followed the Quickstart guide I only experienced the OAuth workflow. This meant I was required to sign in, in order to get my application to make changed to the Google Sheet. This was not viable in a production environment. OAuth would only make sense if I was manipulating Google Sheets on a users behalf. It would be ok for a user to be shown a Google login page to complete and on completion their access token to be stored on the server for authentication to the API. I haven’t provided any code examples for this because Google have already provided this here. API … -
Authenticating Google Client Library for a Django Application
Recently I was tasked with integrating Google Sheets with Django. It was necessary for a row to be added to a Google Sheet on completion of a user action. Having no experience with interacting with Google Sheets programmatically, a quick search found me the Google Sheets API V4 Python Quickstart Guide. Remember: I needed to append a row a Google sheet on behalf of the application NOT the user. OAuth I followed the quickstart guide and was able to create a functioning application that was able to add a row to Google Sheets. However as I simply followed the Quickstart guide I only experienced the OAuth workflow. This meant I was required to sign in, in order to get my application to make changed to the Google Sheet. This was not viable in a production environment. OAuth would only make sense if I was manipulating Google Sheets on a users behalf. It would be ok for a user to be shown a Google login page to complete and on completion their access token to be stored on the server for authentication to the API. I haven’t provided any code examples for this because Google have already provided this here. API … -
Predicting The Future - Building SaaS #70
In this episode, we worked on two issues. The first issue was fixing incorrect projected completion dates of tasks. We used test driven development to reveal the bug and work on the fix. The second issue add some extra data to display on a page. We picked a couple of tasks at random to fix for this stream session. The first issue related to the course view when paired with what the student’s actions. -
Python Dependency Injection
This post looks at how to use dependency injection to decouple and improve the design of a Python application. -
Mirrors migrated out of bitbucket
As you are probably aware, bitbucket is dead. At least the original bitbucket as we knew it, the leader in mercurial hosting. They no longer host mercurial repositories, so I had to move my kernel and Django mirrors. They are now hosted on my own heptapod instance, at the following URL: https://hg.freehackers.org/ I did the […] -
Administer All The Things
In the previous Understand Django article, we used models to see how Django stores data in a relational database. We covered all the tools to bring your data to life in your application. In this article, we will focus on the built-in tools that Django provides to help us manage that data. What Is The Django Admin? When you run an application, you’ll find data that needs special attention. Maybe you’re creating a blog and need to create and edit tags or categories. -
How to configure Environment Specific settings in Python Django Framework?
There are certain configurations in your settings.py such as DEBUG, STATIC_URL, DATABASES, SECRET_KEY, ALLOWED_HOSTS, etc. These settings are actually the ones that you need to look after while deploying to the production environment. Whenever your application goes live, you shouldn't display your debug logs, or error messages on the browsers. This will make your application vulnerable. Also you might want to put different secret keys. For these reasons, we need environment-specific settings. In this tutorial, I will be creating different settings for local, development, and production environment. -
Django News - Issue 37 - Aug 21st 2020
News GSOD 2020 Project - Django Internals / Mentorship With Google Season of Docs (GSOD) kicking off, Gabby Precious wants to know if you have any specific challenges with Django's contribution documentation? djangoproject.com Python Insider: Python 3.7.9 and 3.6.12 security updates now available The lastest security fix rollups for Python 3.7 and Python 3.6 are now available. blogspot.com Tailwind CSS v1.7.0 (1.7.1, 1.7.2, and 1.7.3) The Tailwind CSS v1.7.x release adds a bunch of new features ranging from gradients, background-clip, gap, contents display, font-size letter-spacing, and more interesting new features. tailwindcss.com Events DjangoCon Australia 2020: Schedule live and tickets on sale 🎟️ Tickets are on sale and the schedule has been released for the 8th DjangoCon AU. djangoproject.com Articles Running Django Tests in Github Actions A nice, concise introduction to how to use GitHub Actions as a CI platform for testing your Django code. banagale.com A deep dive into the official Docker image for Python Itamar Turner-Trauring Itamar does an excellent job of deconstructing the official Python image for Docker and gives some sound advice and tips along the way. pythonspeed.com Why Internationalization and Localization matters by Nicolle Cysneiros A practical and concise guide to Internationalization and Localization using Python … -
Create icns Icons for macOS Apps.
I've been working a lot with E... -
We've released a new python book!
That's right, we've released Practical Python Projects, a book of twelve bite-sized weekend projects to enhance your Python knowledge! And the first 25 people to use code "ppp-feldroy-blog" will get 15% off the purchase price! Practical Python Projects is a book authored by Yasoob Khalid. We've admired Yasoob's code and writing for years. The level of his work is set at the level of quality the Feldroy team constantly strive to meet. In fact, you can read for free Yasoob's popular and free first book, Intermediate Python. This book does more than just walk readers through code, it teaches how the research was done for each project. Building off this research, each chapter ends with a "next steps" section guiding the reader towards making the project unique to themselves. Want to know what we think of Practical Python Projects? "A favorite way to for developers to grow their programming skills is by building small practical projects. Yasoob's book embraces this idea, taking the reader on a tour of over a dozen projects, reinforcing research and coding skills along the way. His technical acumen combines with unbridled enthusiasm to make for a delightful and informative book." -- Daniel Feldroy, co-author of … -
Polishing and Usability - Building SaaS #69
In this episode, we polished some parts of the application. Now that my first customer is using the app regularly, the feedback is coming in rapidly. We worked to fix some of the issues that she found. The first issue that I tackled dealt with ambiguity about a course’s relationship to a school year on the course’s detail page. I fixed this issue by displaying the grade level on the course page to provide all the details. -
A Guide to Django Web Development for your Business
It’s frustrating to decide the technology stack for your product – unless you are an experienced CTO. Whether to choose Ruby on Rails or Flask or Django web development or anything else – it’s challenging. Even when you decide on a framework, there are various problems. Trusting the framework for fulfilling your requirements is an […] The post A Guide to Django Web Development for your Business appeared first on BoTree Technologies. -
Async Views in Django 3.1
This post looks at how to get started with Django's new asynchronous views. -
Creating a Low Cost Managed Kubernetes Cluster for Personal Development using Terraform
Kubernetes is an open-source system that's popular amongst developers. It automatically deploys, scales, and manages containerized applications. Yet for those working outside of the traditional startup or corporate setting, Kubernetes can be CPU and memory-intensive, disincentivizing developers from using a strategically beneficial tool. We'll highlight some of the constraints posed by using Kubernetes and offer a series of low-cost, practically-beneficial solution: a Google Kubernetes Engine cluster deployed and managed with Terraform. Want to run Kubernetes locally? [Kind](https://github.com/kubernetes-sigs/kind) is a tool that’s remarkably easy to set up and experiment with. It even supports multi-node clusters! However, the abundance of pods and nodes can be CPU/memory intensive. Another potential roadblock is the popularity of managed Kubernetes solutions: since many companies go this route, you'd want to have some experience with a managed solution. Gaining this experience in a non-corporate setting means personally using Managed Kubernetes –– a costly investment for a solo developer. The baseline cost for an EKS cluster is $72 per month, with similar pricing for regional AKS and GKE clusters. Add in additional node costs for running your workloads and before you know it, you’re running a hefty monthly bill. Here are some potential ways to address computer and … -
Django News - New Wagtail Release and results from the Django Developers Survey 2020 - Aug 14th 2020
News Wagtail 2.10 Released A major new release with a configurable workflow system, full page and site history, a design overhaul of the page editor, Django 3.1 support, search query expressions, bulk redirect importing, and more. wagtail.io HTTPX 0.14.0 Released A major new release in HTTPX, the async successor to Requests. github.com Django Developers Survey 2020 Results from the Django Developers Survey 2020 were released. google.com Python Insider: Python 3.9.0rc1 is now available Python 3.9.0 is almost ready. This release, 3.9.0rc1, is the penultimate release preview. blogspot.com Deadline to nominate someone for Quarter 3 consideration is August 20, 2020 If you want to recommend someone to be a PSF Fellow, you have until August 20th to do so. python.org Events Django Boston August 2020 Virtual Event Benjamin "Zags" Zagorsky will present "Rapid Prototyping in Django," a distilled set of lessons and recommendations for how to build a functional Django website in 2 days and not regret it later. meetup.com Articles Django Views — The Right Way An opinionated guide on how to write views in Django. github.io Using Postgres JSONB Fields in Django In-depth look at using Postgres JSONFields in Django. pganalyze.com Customize the Django Admin With Python A guide … -
Deploying Django to AWS ECS with Terraform
In this tutorial, we'll look at how to deploy a Django app to AWS ECS with Terraform. -
Rendering Calendars - Building SaaS #68
In this episode, I worked on rendering a calendar of important events in a school year. We built out the appropriate data structures, and I wrote some new model methods and added tests. On the last stream, I created a new model to track breaks in the school year. The app now shows the calendar for the school year, and I want to display the breaks on the calendar. Before digging too far into the code, I provided my thoughts about using Docker for development from a question that came from the chat. -
Fixing Up Permissions After Data Migration in Django
Hello djangonauts, today I wanna talk about a problem that I faced while working with Django. So here’s the thing I just recently performed a major release at work, the database had to be changed since we had newer migrations and database structure. Naturally I had to import some data from my older database to the new one, which for most of the part could safely be done using fixtures (or so I thought). So I would like to share some tips and things that I learned recently because of it. Tip #1 Always exclude the Content Type table while exporting a fixture for data migration. It can be done as follows: python manage.py dumpdata --exclude=contenttypes Why? You may ask? It’s because Django automatically creates these records when you perform the migrations for your apps. These records are basically used by django internally for schema management. So if you import them from the older database, Django would raise errors. Tip #2 Now if you were like me, you might have dumped your permissions records as well into the fixture, that’s where the fun part comes in. Now since content type was created afresh for the newer database, so their ids … -
August 2020 Courses
Live, Interactive, Online Courses For years Audrey and I have travelled giving in-person training sessions. With current events being what they are, I've switched to giving live, online, interactive trainings using Zoom meeting software. This has involved some major refactoring of content. Here are the upcoming courses on my calendar: August 14: Django Best Practices the Two Scoops Way August 21, 22, 23: Django Crash Course Live -
Distributed Locking in Django
As you start scaling an application out horizontally (adding more servers/instances), you may run into a problem that requires distributed locking. That's a fancy term, but the concept is simple. Sometimes you have to be sure that when a block of code is running (usually modifying data somewhere), no other instances runs that same block of code. Ideally, you can design your code not to require locks, but sometimes it is inevitable. In general, locks are used when you need to modify state (e.g. the database) in an atomic manner. Some examples of when you might need a distributed lock: Cron jobs/scheduled tasks whose runtime may exceed the interval with which they are triggered Flushing a write-back cache to the database. Bulk processing files If running the code on multiple servers simultaneously would result in corrupted or duplicate data, you probably need to use a distributed lock. The code in question will acquire the lock before execution. Once it has the lock, any other attempt to acquire it will fail. Implementations Lock data must be stored in a location accessible to all application instances. If this is a standard Django site, you probably already have two such systems available to … -
Distributed Locking in Django
As you start scaling an application out horizontally (adding more servers/instances), you may run into a problem that requires distributed locking. That's a fancy term, but the concept is simple. Sometimes you have to be sure that when a block of code is running (usually modifying data somewhere), no other instances runs that same block of code. Ideally, you can design your code not to require locks, but sometimes it is inevitable. In general, locks are used when you need to modify state (e.g. the database) in an atomic manner. Some examples of when you might need a distributed lock: Cron jobs/scheduled tasks whose runtime may exceed the interval with which they are triggered Flushing a write-back cache to the database. Bulk processing files If running the code on multiple servers simultaneously would result in corrupted or duplicate data, you probably need to use a distributed lock. The code in question will acquire the lock before execution. Once it has the lock, any other attempt to acquire it will fail. Implementations Lock data must be stored in a location accessible to all application instances. If this is a standard Django site, you probably already have two such systems available to …