Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
How to Create Django Application Authentication (Sign up and Login)
Hello, and welcome to this simple but effective tutorial on how to create Django user sign-up and login page. In this tutorial we will learn how to use Django's pre-built user register form called 'UserCreationForm'. This built-in form also have a bu... -
Writing automated tests for your Django app | An introduction to continuous integration (CI)
Have you ever bought a pen and tried to write something on a random piece of paper to see if it works? why do you test it even when we all know it is a pen and pens are supposed to write stuff? You do that to ensure you do not pay for a faulty pen be... -
Django Debug Toolbar
Debugging Django Applications - Django Debug Toolbar In my previous post I showed you how to setup VSCode in order to debug Django applications. In this post, I will show you how to the Django Debug Toolbar and how to install it. The Django debug ... -
Django News - Django security releases 3.2.5 and 3.1.13 - Jul 2nd 2021
News Django security releases (3.2.5 and 3.1.13) Django versions 3.2.5 and 3.1.13 have been released. They fix one security defect with severity “high." As always, it is strongly recommended to update to the latest version of Django in your projects. djangoproject.com Python 3.9.6, 3.8.11, 3.7.11, and 3.6.14 Python 3.9.6 is the newest major stable release. Python 3.8.11 marks the first security-only release joining 3.7.11 and 3.6.14 in the security-only stage of their life cycles. blogspot.com Events DjangoCon US 2021 - Call for Proposals The online conference runs October 21st - 23rd. CFP closes on July 18. papercall.io Articles How to Start a Production-Ready Django Project Vitor from SimpleIsBetterThanComplex.com shows his approach for organizing Django projects these days. simpleisbetterthancomplex.com Built-in Permission Classes in Django Rest Framework A look at the 7 built-in permission classes in DRF. testdriven.io How to use Python’s HTTPStatus with Django - Adam Johnson A look at two different ways to use HTTPStatus in your Django code. adamj.eu YAGNI exceptions A look at several You Ain't Gonna Need It exceptions for Django apps. There are some things which really are easier to do earlier than later, and where natural tendencies or a ruthless application of YAGNI might neglect … -
Deploying Django Web App Using Heroku (Updated)
Heroku is one of the most popular hosting platforms for web applications. In this article, I will provide a step-by-step guide on how to deploy a Django web application in Heroku. Signup for Heroku if you don't have an existing account. Install the... -
Debugging Django Applications
Debugging Django Applications in VSCode All new programmers typically start with using console.log() statements in JavaScript or print and pprint statements in python to see what is going on in their code. In python, If you are using print to log o... -
Build a Custom User Registration Form in Django
Django framework comes with a UserCreationForm form that helps in creating user accounts quickly. By default, registration requires users to enter username, password and password confirmation. That's cool! This is all written by a built-in class tha... -
Learning Backend WebDev, Log #11 - Got a Django Certificate! Some Reflections
Been a few days since I wrote about Django. Last week was a roller coaster personally, so I took things slow. And then got back to a rhythm this week. Read more… (3 min remaining to read) -
How to use Python’s HTTPStatus with Django
A “magic number” is the anti-pattern of using a number directly rather than storing it in a descriptive variable name. In web code HTTP status codes are often used as magic numbers, perhaps because web developers memorize common codes such as 200 and 404. In Python, we can avoid such magic with descriptive references from the standard library’s http.HTTPStatus enum. Let’s look at two ways to use HTTPStatus in our Django code. 1. Creating Responses Django includes a bunch of HttpResponse subclasses for common status codes, but the list is deliberately non-exhaustive. If we need to return a status code for which a classes does not exist, we can use Python’s HTTPStatus with Django’s HttpResponse. For example, if one of our pages is unavailable due to legal reasons, so we want to return status code 451. We can do this with HttpResponse like so: from http import HTTPStatus from django.http import HttpResponse def taken_down(request): ... return HttpResponse( content, status_code=HTTPStatus.UNAVAILABLE_FOR_LEGAL_REASONS, ) If we find ourselves using a status code a lot in our project, we can create our own HttpResponse subclasses, as the documentation mentions. For example: from http import HTTPStatus from django.http import HttpResponse class HttpResponseLegallyUnavailable(HttpResponse): status_code = HTTPStatus.UNAVAILABLE_FOR_LEGAL_REASONS Additionally, … -
How to use Python’s HTTPStatus with Django
A “magic number” is the anti-pattern of using a number directly rather than storing it in a descriptive variable name. In web code HTTP status codes are often used as magic numbers, perhaps because web developers memorize common codes such as 200 and 404. In Python, we can avoid such magic with descriptive references from the standard library’s http.HTTPStatus enum. Let’s look at two ways to use HTTPStatus in our Django code. 1. Creating Responses¶ Django includes a bunch of HttpResponse subclasses for common status codes, but the list is deliberately non-exhaustive. If we need to return a status code for which a classes does not exist, we can use Python’s HTTPStatus with Django’s HttpResponse. For example, if one of our pages is unavailable due to legal reasons, so we want to return status code 451. We can do this with HttpResponse like so: from http import HTTPStatus from django.http import HttpResponse def taken_down(request): ... return HttpResponse( content, status_code=HTTPStatus.UNAVAILABLE_FOR_LEGAL_REASONS, ) If we find ourselves using a status code a lot in our project, we can create our own HttpResponse subclasses, as the documentation mentions. For example: from http import HTTPStatus from django.http import HttpResponse class HttpResponseLegallyUnavailable(HttpResponse): status_code = HTTPStatus.UNAVAILABLE_FOR_LEGAL_REASONS Additionally, … -
FullStack React & Django Authentication : Django REST ,TypeScript, Axios, Redux & React Router
As a full-stack developer, understand how to build an authentication system with backend technology and manage the authentication flow with a frontend technology is crucial. In this tutorial, we'll together build an authentication system using React ... -
1. Introduction to Django as a Framework
Welcome back people, let's make this brief and precise. Okay. Some of us already know Django, some of us don't, let's discuss what django is first. Folks, meet Django, Django, meet folks Django is a high-level Python Web framework that encourages rap... -
Octoprofile - the Django project
I am very happy to share with you the Django project I have been working on last 20 days, it's called an Octoprofile. Project Octoprofile displays the GitHub profile in a better way with Charts and sortable lists. Octoprofile collects the user infor... -
How I clone the Movement Pass service website of Bangladesh
Where does it come from? Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney Colle... -
A Python Dev??
I promise this will be short not just because I don't have much to say but because I am bad at expressing myself. I decided to start this "blog" because after scrolling through Hashnode I haven't found an article that shows other devs being stumped. ... -
How to Start a Production-Ready Django Project
In this tutorial I’m going to show you how I usually start and organize a new Django project nowadays. I’ve tried many different configurations and ways to organize the project, but for the past 4 years or so this has been consistently my go-to setup. Please note that this is not intended to be a “best practice” guide or to fit every use case. It’s just the way I like to use Django and that’s also the way that I found that allow your project to grow in healthy way. Index Premises Environments/Modes Local Tests Production Project Configuration Requirements Settings Version Apps Configuration App Structure Code style and formatting Editor Config Flake8 isort Black Conclusions Premises Usually those are the premises I take into account when setting up a project: Separation of code and configuration Multiple environments (production, staging, development, local) Local/development environment first Internationalization and localization Testing and documentation Static checks and styling rules Not all apps must be pluggable Debugging and logging Environments/Modes Usually I work with three environment dimensions in my code: local, tests and production. I like to see it as a “mode” how I run the project. What dictates which mode I’m running the project … -
Use get_object_or_404 in Django to write lesser code
While writing APIs that retrieve a single object from your database, it is best to use get_object_or_404 as it can help you save 4 lines of code and convert it into 1 line. -
Setting up a basic Django Project with Pipenv
Django is a Python-based Web framework built for rapid Web Development. In this blog post, I try to answer the question - "How do I set up a Django project from scratch?". In other words, setting up a Django project structure by following the best... -
FYP-DevLog-011
Progress Highlights Defended my FYP1 proposal during my viva session on Monday. The session is supposed to last for 15 minutes tops, but mine went on for nearly twice as long. Biggest highlight was how both panels agreed that while the project has a... -
Django News - PSF Election Results and PWC Videos Released - Jun 25th 2021
News 2021 PSF Board of Directors Election Results 599 ballots of 1,538 eligible voters were cast for this year's PSF election. The three top vote-getters were: Joannah Nanjekye Débora Azevedo Tania Allard python.org Events Talks and Tutorials from 2021 Python Web Conference Released Sixty video recordings from Six Feet Up’s 3rd annual 2021 Python Web Conference are now available. sixfeetup.com Sponsored Link Stay secure with CodeStasis We keep legacy Django versions up to date by backporting and writing patches to fix security vulnerabilities, data loss bugs, and other issues. Free for personal use, while a paid subscription for businesses. Django 1.11 – 3.0 available now. Get notified when 1.10 and earlier versions are released. codestasis.com Articles Subclassing in Python Redux The conflict between subclassing and composition is as old as object-oriented programming. The latest crop of languages like Go or Rust prove that you don’t need subclassing to successfully write code. But what’s a pragmatic approach to subclassing in Python, specifically? hynek.me How Mock Can Improve Your Unit Tests: Part 1 A 2-part series from Caktus Group on using mocks to improve unit tests. caktusgroup.com The ritual of the deploy by Vicki Boykis Vicki breaks down how rituals and superstitions … -
Setup JWT for a React Django app in minutes
In my previous post, I explained what the JWT are. Today I will show you how to use it in a project with a React frontend and a Django backend. The backend part with Django I guess you already have basic knowledge of Python, Django and Django Rest Fr... -
What's the Ultimate Reason for Working at Octopus Energy?
On November 16, 2020, I started my first day of employment at Octopus Energy. A few days ago I discussed reasons why I enjoy my work and colleagues. In this article, I explain the ultimate reason I work for Octopus Energy. A Realization One day in autumn of 2020, while considering new employment, I was talking to many potential employers. Several organizations stood out above all others. They stood out because they both had a mission to address global climate change. I realized I could use all my talents and skills to make the planet a better place. Concerns About Climate Change For years I've been concerned about the changing climate. I had been reducing my carbon footprint for years, composting, reducing unnecessary travel, and more. I preferred to vote for eco-friendly political candidates. In many other ways, I did what I could, yet always I wanted to do more. The Ultimate Reason I Work for Octopus It's all about this little girl. I want to give my daughter a better planet. She and her generation deserve to live in the same kind of world I had growing up. Enter Octopus Energy Octopus Energy is giving me the chance to … -
Creating a COVID-19 dashboard with Django & ChartJS
In this article, we will create a COVID-19 dashboard using the Django Framework in Python. We will use some API to fetch data on active, confirmed, recovered, and deceased cases and try to answer questions like: How does the National Spread of the v... -
Built-in Permission Classes in Django Rest Framework
This article looks at how the built-in permission classes work in Django REST Framework. -
Connecting Google Cal API and Django
Some tricky configuration is required, and the existing Python-specific documentation is sparse and buggy (or simply not written for a production setting). My eventual solution involves using a Google Cloud Platform service account and a custom Herok...