Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Deploying Your Django App To Heroku
Requirements: Git—Click the link and download the installer. Heroku CLI — Click the link and download the installer. After successfully installing the above requirements, below are the steps for deploying your react app to heroku. Step 1 — Sign u... -
I Can’t Do This Yet … Updated
Updated version of the post. I seem to have somehow, mangled the old one. I’ll just blame it on the gremlins in the cloud. Read more… (4 min remaining to read) -
Django - Getting Started
This post was co-authored with fellow General Assembly Software Engineering Immersive member JC Coles If you've written full stack applications in JavaScript using Node, Express, perhaps Mongoose for accessing a database, maybe some packages like Pas... -
Django News - Django Technical Board Registration - Apr 16th 2021
News Announcement of 4.x Technical Board Election Registration A new Technical Board will be elected for Django 4.0+. All DSF Members are automatically eligible to vote. if you are not a DSF Member but would like to apply to vote, please register online. djangoproject.com Django Debug Toolbar security releases issued: 3.2.1, 2.2.1 and 1.11.1. These releases address a security issue with severity "high." We encourage all users of Django Debug Toolbar to upgrade as soon as possible. djangoproject.com DEFNA: Board Updates DEFNA Board updates for 2021. defna.org Get PyCharm, Support Django Until April 29, you can purchase PyCharm at 30% off and the full purchase price will be donated to the Django Software Foundation. jetbrains.com Sponsored Link Migrating from Django 1.7 to 3.1 is no small task. Learn how to successfully leapfrog a massive Django/Python upgrade. sixfeetup.com Articles Deploying Django at small scale by Timo Zimmermann An interesting look at building and deploying an intentionally small scale Django site. screamingatmyscreen.com Big Bay Dam Monitoring Dashboard: 4-Part Tutorial Learn how to build a dam safety monitoring dashboard using Django. engineertodeveloper.com Fluent in Django: Improving your application The second part in a series covers uploading an image, using packages, pagination, and customizing … -
Are You Stuck On Vision, Strategy, or Tactics?
When organizations are performing well, the whole is more than the sum of its parts. That’s the whole point of building teams: together we can accomplish more than if we work solo. But many organizations get stuck: suddenly, the whole becomes less than the sum of its parts! When this happens, it can be difficult to understand what’s going on: everyone can be working hard, and yet as a whole, the team just seems to be treading water. When this happens, I’ve found a useful model for understanding what’s going on. I like to ask: is the organization stuck on vision, strategy, or tactics? -
Introducing the heroicons Python Package
heroicons is a free SVG icon set for your websites, from the creators of tailwindcss. SVG icons are great - they’re small, they sit inline in your HTML, and you can scaled and colour them with plain HTML and CSS. And heroicons is a great icon set - minimal, clear, and consistent. I’ve decided to use both tailwindcss and heroicons in DB Buddy. Since others have shown interest I’ve turned my work into a package. heroicons itself provides the icon set on their web page for copy-pasting, but this gets tiresome. Inline SVG’s have no labels, and bloat template files. heroicons provides React and Vue packages to summon icons by name, and a zip file for the rest of us. My new python package heroicons bundles a shrunken version of that zip file, to provide both Django and Jinja template tags. Using these you can include an icon by name, set its size, and add extra HTML attributes. For example, in a Django template: {% load heroicons %} {% heroicon_outline "academic-cap" size=48 class="h-4 w-4 inline" data_controller="academia" %} It currently bundles version 1.0.1 of the icon set, and I’ll update it as new releases come out. Check it out on PyPI. … -
Introducing the heroicons Python Package
heroicons is a free SVG icon set for your websites, from the creators of tailwindcss. SVG icons are great - they’re small, they sit inline in your HTML, and you can scaled and colour them with plain HTML and CSS. And heroicons is a great icon set - minimal, clear, and consistent. I’ve decided to use both tailwindcss and heroicons in DB Buddy. Since others have shown interest I’ve turned my work into a package. heroicons itself provides the icon set on their web page for copy-pasting, but this gets tiresome. Inline SVG’s have no labels, and bloat template files. heroicons provides React and Vue packages to summon icons by name, and a zip file for the rest of us. My new python package heroicons bundles a shrunken version of that zip file, to provide both Django and Jinja template tags. Using these you can include an icon by name, set its size, and add extra HTML attributes. For example, in a Django template: {% load heroicons %} {% heroicon_outline "academic-cap" size=48 class="h-4 w-4 inline" data_controller="academia" %} {% endhighlight %} It currently bundles version 1.0.1 of the icon set, and I’ll update it as new releases come out. Check it … -
Project Beacon - Jackson Wilkinson
@mjacksonwProject BeaconPathAIViget: Consultancy that built siteAptibleUS Digital ResponseSupport the ShowThis podcast is a labor of love and does not have any ads or sponsors. To support the show, please consider recommending a book from LearnDjango.com, signing up for the free weekly Django News newsletter, or learning more about Button, a simpler deployment story for Django. -
Google/Apple token verification with Django
Overview Over the past few weeks, I have been working on a project where one of the main requirements is to enable token verification and authenticate or register & authenticate a user with Django. What we’re going to do We are going to use google-a... -
Testing in Python
This article looks at some tools and techniques that help make testing in Python easier. -
Why Is Django Considered A Perfect Choice For Software Development In 2021?
Hello! Meet Django. In this era, Django is leading because it has become every business’s need. But why is Django Development so popular? “Django is an open-source high-level Python framework that serves the primary purpose of enabling super-fast dev... -
django-feature-policy is now django-permissions-policy
I created django-feature-policy in 2018 allow Django projects to control the draft security header Feature-Policy. Feature-Policy allows your site to restrict which origins can use some sensitive browser features, such as the the payments API or access to the webcam. This is valuable if you’re using any third party JavaScript. Whether such JavaScript comes from npm or an external script tag, you can protect against it doing some bad things with your users. In 2020 a new specification renamed the header to Permissions-Policy, with different syntax. Browsers updated accordingly, so I also updated django-feature-policy. I left it sending both the old and new forms so that older browser versions would remain protected. A few weeks ago, I updated my package once more, renaming it to django-permissions-policy, and removing the old Feature-Policy header. This is because Chrome now logs warnings about the old Feature-Policy header. To update for the rename, I uploaded the new version as django-permissions-policy version 4.0.0, and released django-feature-policy 4.0.0 as an empty package that depends on the new name. Thanks to Simon Willison for his repo template demonstrating this technique. If you are using django-feature-policy, updated and swap it for django-permissions-policy. And if you’re not, try it … -
django-feature-policy is now django-permissions-policy
I created django-feature-policy in 2018 allow Django projects to control the draft security header Feature-Policy. Feature-Policy allows your site to restrict which origins can use some sensitive browser features, such as the the payments API or access to the webcam. This is valuable if you’re using any third party JavaScript. Whether such JavaScript comes from npm or an external script tag, you can protect against it doing some bad things with your users. In 2020 a new specification renamed the header to Permissions-Policy, with different syntax. Browsers updated accordingly, so I also updated django-feature-policy. I left it sending both the old and new forms so that older browser versions would remain protected. A few weeks ago, I updated my package once more, renaming it to django-permissions-policy, and removing the old Feature-Policy header. This is because Chrome now logs warnings about the old Feature-Policy header. To update for the rename, I uploaded the new version as django-permissions-policy version 4.0.0, and released django-feature-policy 4.0.0 as an empty package that depends on the new name. Thanks to Simon Willison for his repo template demonstrating this technique. If you are using django-feature-policy, updated and swap it for django-permissions-policy. And if you’re not, try it … -
Deploying Django at small scale
It feels like common knowledge and an accepted fact that you want to run PostgreSQL in production. And have some sort of load balancer to be able to scale your application server horizontally. Throw in Redis for caching and you have the most generic web application stack I can come up with. At scale this makes a ton of sense. It is a battle tested stack, that will most likely not fail you and if it does, there are tons of resources on how to fix it. Those are a lot of moving parts you want to keep updated and maintained, so let us talk about simplifying this stack a bit for small scale deployments. There are lots of resources out there explaining the setup I mentioned above. Those resources are valuable and will guide you through production setups you will see at many places. But what when you are just starting and want to get your first application online? Things can be a lot easier. I recently started moving my blog and photo sharing site to their own, small virtual server. I just blogged about the reason for doing this, so I will not go into detail. Both sites … -
How to register a model in django
A model is the single, definitive source of information about your data. It contains the essential fields and behaviors of the data you’re storing. Generally, each model maps to a single database table. Create your project folder e.g "my project" and... -
FYP-DevLog-005
Progress Highlights Project Research Drafted the low-level 3-tier system architecture diagram for Fitweet using Visual Paradigm (my favourite UML diagram tool) Attended 5th FYP meeting with supervisor to discuss regarding Use Case Description (UCD... -
Django Models
Hi guys, in the last article we looked into Django architecture where we stated that Django is majorly of three layers i.e Model layer, Views layer and Template layer (MVT structure). So in this article we will look into the full gist about Django ... -
Deploying Django at small scale
Deploying Django at small scale It feels like common knowledge and an accepted fact that you want to run PostgreSQL in production. And have some sort of load balancer to be able to scale your application server horizontally. Throw in Redis for caching and you have the most generic web application stack I can come up with. At scale this makes a ton of sense. It is a battle tested stack, that will most likely not fail you and if it does, there are tons of resources on how to fix it. Those are a lot of moving parts you want to keep updated and maintained, so let us talk about simplifying this stack a bit for small scale deployments. There are lots of resources out there explaining the setup I mentioned above. Those resources are valuable and will guide you through production setups you will see at many places. But what when you are just starting and want to get your first application online? Things can be a lot easier. I recently started moving my blog and photo sharing site to their own, small virtual server. I just blogged about the reason for doing this, so I will not … -
How to convert a TestCase from setUp() to setUpTestData()
Django’s TestCase class provides the setUpTestData() hook for creating your test data. It is faster than using the unittest setUp() hook because it creates the test data only once per test case, rather than per test. Converting TestCases from setUp() to setUpTestData() is one of the most reliable ways to speed up a test suite, with no costs beyond from the time it might take to change your code. I’ve often found it confers a 3x speedup, or more. Here’s my how-to guide for doing this conversion for a single TestCase. Rinse and repeat across your code base! Example Test Case We’ll convert this test case: from django.contrib.auth.models import User from django.test import TestCase from example.core.models import Book class IndexTests(TestCase): def setUp(self): self.book = Book.objects.create(title="The Checklist Manifesto") self.user = User.objects.create_user( username="tester", email="test@example.com", ) self.client.force_login(self.user) def test_one(self): ... def test_two(self): ... 0. Install django-testdata on Django < 3.2 Before Django 3.2, use of setUpTestData() has a major caveat: Django rolls back changes to model instances in the database but not in memory. This means you often need extra code to re-fetch data to ensure tests are correctly isolated. Django 3.2 includes a fix: TestCase now copies any objects created in setUpTestData() … -
Weeknotes (2021 week 13 and 14)
Weeknotes (2021 week 13 and 14) Sorting django-admin-ordering instances in Python code django-admin-ordering‘s OrderableModel gained a __lt__ function (and functools.total_ordering) in 0.14 which allows sorting model instances in Python code. This is useful for my projects. Some user agents do not like single quotes in OpenGraph tags Django autoescapes content inserted into HTML (an excellent default). It also converts some special characters into entities (resp., html.escape does this). It seems that some user agents do not like entities in OpenGraph tags and show &x27; instead of '. Oh well. I added a workaround for this problem to feincms3-meta. It checks whether the value is safe1 and basically skips escaping in this case – at least I hope it is safe! feincms3-forms – A new forms builder for the Django admin interface For a current project we needed a forms builder with the following constraints: Simple fields (text, email, checkboxes, dropdowns etc.) Custom validation and processing logic It should be possible to add other content, e.g. headings and explanations between form fields The form_designer fulfilled a few of these requirements but not all. It still works well but I wanted a forms builder based on django-content-editor for a long time already. … -
Django News - Django 3.2 release! - Apr 9th 2021
News Django 3.2 released! Django 3.2 is a long-term support (LTS) release meaning that security and data loss fixes will be applied for at least the next three years. The last LTS release was 2.2. The release notes contain new features in detail. djangoproject.com Django security releases issued: 3.1.8, 3.0.14, and 2.2.20 A "low" severity security issue has been addressed with the new release of Django 3.1.8, Django 3.0.14 and Django 2.2.20. We encourage all users of Django to upgrade as soon as possible. djangoproject.com Python 3.9.4 and 3.8.9 are now available Those are expedited security releases, recommended to all users. blogspot.com Get PyCharm, Support Django Until April 29, you can purchase PyCharm at 30% off and the full purchase price will be donated to the Django Software Foundation. jetbrains.com Python Software Foundation News: The PSF is hiring a Developer-in-Residence to support CPython! The Python Software Foundation is happy to announce the creation of the Developer-in-Residence role. The Developer-in-Residence will work fu... blogspot.com Tailwind CSS v2.1 – Tailwind CSS We just released Tailwind CSS v2.1 which brings the new JIT engine to core, adds first-class CSS filter support, and more! What is new in Tailwind CSS version 2.1? is a … -
I Can’t Do This … Yet.
I’ve been “soft” looking for a job, since the end of last year when I learnt the basics of Python. (Want me to come work you as a junior developer? Here’s my resume!) Read more… (2 min remaining to read) -
Creating a virtual environment with python...
This guideline will be tailored towards Linux Operating System but I will drop the Windows Operating System equivalent as we go on. There are several ways people create an environment while writing a python project, be it web, data science, or machin... -
A Love Letter to Books
Despite financial troubles there’s a sense in which my childhood was immensely privileged — a pauper in the material world, I was a sultan in the world of ideas. — Erik Hoel I started by wanting to share that quote and link on my microblog and then my thoughts turned into a blog post sized comment. I decided to post it here too, then. Read more… (2 min remaining to read) -
How to Create a Fancy Range-Slider Filter in Django
Introduction In this tutorial, we are going to create a nice crispy range slider using django-crispy-forms for an integer filter provided by django-filters. The tutorial can be split into four sections. In the first or prerequisite section, we will i...