Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Store Data With Models
In the previous Understand Django article, we encountered forms and how forms allow your application to receive data from users who use your site. In this article, you’ll see how to take that data and store it into a database so that your application can use that data or display it later. Setting Up Let’s figure out where your data goes before getting deep into how to work with it. -
Adding two factor authentication to Django admin
Adding two factor authentication to Django admin As my dissatisfaction with WordPress grew, I did the only Reasonable Thing™ and decided to roll out my own CMS again. Which means I do not only have the joy of building a tool exactly fitting my needs, but I also have to build some of the functionality I would expect every production-ready system to provide. Account security in Django’s contrib.auth and contrib.admin package did not change a lot over the last decade, but in 2020 I expect some basic functionality from every system, like two factor authentication. As 2FA is missing in Djangos admin package, what is the Reasonable Decision™? To add it myself, of course. You might see a trend of “reasonable yak shaving” here. (A small side note if you are working on a SaaS or web app right now: Account security is not a “premium feature” or a feature your users should have to pay for. It is basic functionality you should always provide to anyone, no matter if they are free or paid users, no matter which plan. And now back to our scheduled program!) This article assumes you have some familiarity with Python and Django; at least … -
Learning Wagtail - Kalob Taulein
LearnWagtail.comCoding for EverybodyKalob’s Udemy coursesawesome-wagtailThis Week in WagtailDjango Search TutorialHow to Get Hired as a Django DeveloperWagtail Slack channelFrom Burn-Out to $100M in ARR with Jason Cohen of WP Engine -
Securing a Containerized Django Application with Let's Encrypt
In this tutorial, we'll look at how to secure a containerized Django app running behind an HTTPS Nginx proxy with Let's Encrypt SSL certificates. -
How to search Google without using Google, the self-hosted way
Hello everyone! Last week I was talking with a friend and he was complaining about how Google knows everything about us, so I took the chance to recommend some degoogled alternatives: I sent him my blog, recommended DuckDuckGo, Nextcloud, Protonmail, etc. He really liked my suggestions and promised to try DuckDuckGo. A couple of days later he came to me a little defeated, because he didn’t like the search results on DuckDuckGo and felt bad going back to Google. So that got me thinking: Are there some degoogled search engines that use Google as the backend but respect our privacy? So I went looking and found a couple of really interesting options. Startpage.com According to their Wikipedia: Startpage is a web search engine that highlights privacy as its distinguishing feature. Previously, it was known as the metasearch engine Ixquick … On 7 July 2009, Ixquick launched Startpage.com to offer its service at a URL that is both easier to remember and spell. In contrast to Ixquick.eu, Startpage.com fetches results from the Google search engine. This is done without saving user IP addresses or giving any personal user information to Google’s servers. and their own website: You can’t beat Google when … -
How to search Google without using Google, the self-hosted way
Hello everyone! Last week I was talking with a friend and he was complaining about how Google knows everything about us, so I took the chance to recommend some degoogled alternatives: I sent him my blog, recommended DuckDuckGo, Nextcloud, Protonmail, etc. He really liked my suggestions and promised to try DuckDuckGo. A couple of days later he came to me a little defeated, because he didn’t like the search results on DuckDuckGo and felt bad going back to Google. So that got me thinking: Are there some degoogled search engines that use Google as the backend but respect our privacy? So I went looking and found a couple of really interesting options. Startpage.com According to their Wikipedia: Startpage is a web search engine that highlights privacy as its distinguishing feature. Previously, it was known as the metasearch engine Ixquick … On 7 July 2009, Ixquick launched Startpage.com to offer its service at a URL that is both easier to remember and spell. In contrast to Ixquick.eu, Startpage.com fetches results from the Google search engine. This is done without saving user IP addresses or giving any personal user information to Google’s servers. and their own website: You can’t beat Google when … -
Setup Django on Mac in 2020
There are many ways to setup Django on MacOS. Here is how to get started while keeping the flexibility to have projects in different versions of Django and different versions of Python too. -
Setup Django on Mac in 2020
There are many ways to setup Django on MacOS. Here is how to get started while keeping the flexibility to have projects in different versions of Django and different versions of Python too. -
How to Learn Django (2023)
__Note__: I gave a version of this tutorial at DjangoCon US 2022. You can see the video here: -
How to pull production data into your local Postgres database
Sometimes you want to write a feature for your Django app that requires a lot of structured data that already exists in production. This happened to me recently: I needed to create a reporting tool for internal business users. The problem was that I didn't have much data in my … -
Working with Celery and Django Database Transactions
This post details how to make Celery work nicely with Django Database Transactions. -
Django in Production - II
Second part of the series covering how to get your django project into production -
Django in Production - II
Second part of the series covering django app deployment Now we’re done with the basic django deployment using gunicorn, now it’s time to make our server scalable. Let’s add a reverse proxy server NGINX and serve our site on port 80. NGINX Installation If you’re using Ubuntu, run the following commands: sudo apt-get update sudo apt-get install nginx Now you can check the status of nginx by running command: sudo systemctl status nginx NGINX Configuration So, for running NGINX you’ll need to write configuration files. They’re stored in the /etc/nginx/sites-available/ directory. Let’s first go into that directory by running: cd /etc/nginx/sites-available/ Now let’s create a file by doing: sudo touch django.conf And now let’s open the file in the editor by doing: sudo nano django.conf Hint: We need to use sudo here because this directory is present in root and not inside our home directory. Then paste the below config inside it. server { server_name server_domain_or_ip; location / { include proxy_params; proxy_pass http://localhost:8000; } } In place of server_domain_or_ip you’ll put either IP address or the domain of your website. So NGINX uses this concept where you can have multiple configuration files as backup stored under /etc/nginx/sites-available/. But the active … -
Django News - No DjangoCon US this year ☹ - Jun 19th 2020
News DjangoCon US 2020 is Canceled After 12 consecutive years of DjangoCons in the United States, we’ve decided to cancel DjangoCon US 2020. djangoproject.com Django 3.1 Beta 1 Released Django 3.1 beta 1 is now available. It represents the second stage in the 3.1 release cycle and is an opportunity for you to try out the changes coming in Django 3.1. djangoproject.com Wagtail Space US 2020 – Call For Proposals The Wagtail Space US CFP deadline is open until July 1, 2020. google.com 2020 Python Software Foundation Board of Directors Election Results The 2020 Python Software Foundation Board of Directors election has concluded. See the results! blogspot.com Articles Postgres websearch in Django 3.1 Django 3.1 includes a new Postgres SearchQuery feature that allows human-formatted search queries. jamesturk.net Optimizing Django ORM Queries If you love optimization articles where they present SQL queries next to Django ORM calls, then you are in for a treat. schegel.net Use Pathlib in Your Django Settings File Get a jump on Django 3.1 and switch to pathlib in your projects. adamj.eu How I manage multiple development environments in my Django workflow using Docker compose A practical Docker Compose overview for how to handle both development and … -
Working with Celery and Django Database Transactions
This post details how to make Celery work nicely with Django Database Transactions. -
Django in Production - I
-
Django in Production - I
Hello djangonauts, today I want to talk about how to run django in production. Introduction So, you might have finished developing that project you were building for your client, and now it’s time to deploy your project on a server and make it accessible to public. But you’re confused on how to proceed further? I was too, but not anymore. The reason why I decided to write this series is that when I had to deploy my project, I had to spend hours searching about it and then read up multiple articles about it, but even then they didn’t cover all the essential details. So that’s what prompted me to write this series, and I am going to go over my setup for running django in production. First thing, I wanna clear up is that when you run your django server using the command: python manage.py runserver This starts up a development server, that is provided by the Django Team only for the purpose of development, you are not supposed to run your projects in production using it. In production, you’ll have to use a WSGI server such as Gunicorn or uWSGI, which I’m going to cover as well. Deployment … -
Hackathon App - Building SaaS #61
In this episode, we took a break from the regular app to work on an app for a local hackathon that I’m participating in. My team is building a mobile web app for the homeless around Frederick, MD. In this stream, we cranked through some modeling, admin building, a couple of pages, tests, and templates! We got a lot done! The virtual hackathon running in Frederick is split into multiple teams serving three different community groups around Frederick county. -
Modern Django Development - Jeff Triplett
Jeff Triplett personal sitePython Software FoundationDjango Release Cycle REVSYSDjango News Newsletterawesome-djangoDEFNATailwind CSS -
Sending Confirmation Emails with Flask, Redis Queue, and Amazon SES
This blog post looks at how to send confirmation emails to newly registered users with Flask, Redis Queue, and Amazon SES. -
Django Best Practices: Custom User Model
Django ships with a built-in [User model](https://docs.djangoproject.com/en/4.0/ref/contrib/auth/#django.contrib.auth.models.User) for authentication and if you'd like a basic tutorial on how to implement log in, log out, sign up and so on see … -
How to Automatically Retrying Failed Celery Tasks
In this tutorial, we'll look at how to automatically retry failed Celery tasks. -
Automatically Retrying Failed Celery Tasks
This post looks at how to automatically retry failed Celery tasks. -
Richer Django logging
I recently tested Rich logging with a Django project and the results were good. Here's what it looks like: © 2020 Will McGugan A Django app with Rich logging Note the file and line at the right hand of the terminal which shows were the log function was called. If your terminal supports hyperlinks, you can click that link to open the file! For reference, here's what it looks like without Rich logging. © 2020 Will McGugan A Django app without Rich logging This is the default RichHandler class in Rich. It would be possible to do a little more customization for Django logs. Maybe highlight 5xx in red, for example. To add this to your Django project, pip install rich then configure the console to use "rich.logging.RichHandler" rather than StreamHandler. LOGGING = { "version": 1, "disable_existing_loggers": False, "formatters": {"rich": {"datefmt": "[%X]"}}, "handlers": { "console": { "class": "rich.logging.RichHandler", "formatter": "rich", "level": "DEBUG", } }, "loggers": {"django": {"handlers": ["console"]}}, } The process is much the same for any project. See the documentation for the Rich logging handler for details. -
Django A/B testing with Google Optimize
A/B testing is a great way to decide what path your product should take. Create two variations, collect data points and see which variation is better. It will help you in understanding your users and their needs. Google Optimize is a tool that simplifies A/B testing by managing variant weights, targeting rules, provides analytics and integrates with other Google product as Google Adwords and Google Analytics. There are two ways to run A/B tests: client-side and server-side. Client-side A/B tests with Google Optimize executes javascript in browser based on the changes you would like (style changes, positioning of elements etc.), it is fairly limited. In server-side A/B tests there are no limitations, you can write any code you'd like which will display different application versions based on the session's active experiment variant. ## The Google Optimize basics When a user visits your site and an experiment is active he will be given an experiment variant which is stored in a cookie called `_gaexp.` The cookie can have the following content `GAX1.2.MD68BlrXQfKh-W8zrkEVPA.18361.1` and it contains multiple values where each value is divided by dots. There are two key values for server-side A/B testing. Firstly, the experiment ID which in the example …