Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
PyGrunn 2023: optimization for mere mortals - Dulaj Disanayaka
(One of my summaries of the May 2023 Dutch PyGrunn conference). Mere mortals? There are two kinds pf people in the world: those that like to optimize and those that are mere mortals :-) He'll try to get us over to the optimization side. Python is pretty slow. It is getting faster and faster all the time, though. And speed isn't everything: readability and maintainability are also important. And a large community. Optimization at the language level will be talked about in the "python under the hood" later during this conference. Something you often hear: Premature optimizaton is bad. Worrying about efficiency in the wrong places and at the wrong times is a real problem accourding to Donald Knuth. Micro-optimization is bad. But... is that so? A small part of your code might be called lots of times. Have you profiled it? Look at the ROI (return on investment). Time spend optimizing code that isn't the actual problem is time that is wasted. Time spend on slow code that is called a lot, that's a good thing. What he's suggesting is what he calls opportunistic optimization. It is a bit like the "boy scouts' rule": make the code a little … -
PyGrunn 2023: your API on-the-fly - Jan Murre
(One of my summaries of the May 2023 Dutch PyGrunn conference). API on the fly? The talk is about autogenerating APIs using "Amsterdam Schema". Jan works for datapunt Amsterdam, a project for being transparant as the city of Amsterdam. Your citizens pay taxes, so they have a right to access the open data that the municipality maintains. They have api projects for many datasets. Like "BAG", the official building database. Or a list of the power sockets for the weekly markets. Lots of geographical information. They use postgres, docker containers, ubuntu, python + django + djangorestframework. Developed specific for this project: django gisserver. DSO, digitaal stelsel omgevingswet, is a Dutch API specification for this kind of data. The various sorts of data are all specified in a json format that they call Amsterdam Schema. All data sets are available as geographical layers. They have a custom django management command (import_schemas --create-tables) to read such a json schema file and create the empty tables in the database. He demonstrated (live) how it works. The data was in the dabase and a nice swagger-like page was shown in the website with the option to browse the REST API. There's even support for … -
PyGrunn 2023: python under the hood, why slow and how to speed it up - Mike Huls
(One of my summaries of the May 2023 Dutch PyGrunn conference). You might get the question "why do you use python, isn't that a slow language"? Well, it is slower than many other languages, but not that slow. You should also look at programmer productivity. You wouldn't write an operating system in python. You also wouldn't write a web framework in C. How python is designed Python is dynamically typed instead of statically typed. This makes it easier for humans to understand and quicker. It makes sure you don't have to deal with many low-level details. But it can cause errors. Python is interpreted instead of compiled. If you compile code, it turns your program into machine code. The compiler has nothing further to do with it. With an interpreter, the interpreter is actually running your code when you run it. So the interpreter can handle all the OS-specific optimizations. "Live". There's byte code caching, so it's not that it does double work. In a compiled language, variables are stored in a fixed location in memory. If you give a variable a new value, that new value is stored in the same memory location. In python, everything is stored as … -
PyGrunn 2023: testing files like a pro ("faker-file") - Artur Barseghyan
(One of my summaries of the May 2023 Dutch PyGrunn conference). You might need files for testing. Real test files are perhaps not available when you need it. Synthetic data might just do fine for most use-cases. Real data might not even be allowed due to privacy concerns, for instance. You could use Faker to generate fake names and adresses and so for your test. You have control over what you generate. faker.zip_code(), faker.company_email(). Faker helps when you need to generate separate fields. But sometime you need actual files. For that you can use faker-file. faker-file works with Faker and factory_boy. It is added as a "faker provider". It supports text, csv, docx, mp3, png, pdf, epub, etc, etc. Also .eml email files. You can have it generate random text, but you can also pass sample text. You can also pass a template: you can use Faker's regular methods like first_name and address in there. Handy! If you generate a png, it will be a png with a bitmap of the text. A zipfile with some folders and docx files is also possible. And zipfiles with folders and zipfiles with pngs in them. So: basically everything. Normally, the files are … -
Hurray, this friday there's PyGrunn again
Hurray, this friday (23 May) there's the 11th installment of the Dutch PyGrunn conference. Time to wake up again at an early hour to grab the train to the north of the Netherlands :-) Oh, and to dig out a historic legendary pygrunn t-shirt (I've chosen the 2012 one). I really enjoy these conferences. There is a nice mix of talks to choose from, from python inner details to how-we-use-it. Here are four that I'm looking forward to: Combining fastAPI and Django. At our company we're using fastAPI for a new project, but all our existing projects are in Django. I hope to get a better feel for the (im)possibilities. Personally I haven't used fastAPI, so a conference like pygrunn helps a to broaden my knowledge. Sebastián Ramírez, the creator of fastAPI, gives the closing talk so that'll be a good source of information. And... Sebastián's talk might also be a good source of a "mental model", a way of thinking about software and software design and projects. He'll talk about how to make code that is less error-prone, simpler, more efficient, and have a great developer experience, all at the same time. And all this while including best practices … -
Django RSS Feed Tutorial
Django comes with a built-in [syndication feed](https://docs.djangoproject.com/en/dev/ref/contrib/syndication/) for dynamically generating [RSS (Really Simple Syndication)](https://en.wikipedia.org/wiki/RSS) or [Atom](https://en.wikipedia.org/wiki/Atom_(web_standard)) feeds. These feeds contain recently updated content on a website, and users can subscribe … -
Django Best Practices: Docker
[Docker](https://www.docker.com/) is a very popular tool for managing Django projects. Many professional developers use it but I find it is still confusing to many newcomers. In this post I'll attempt … -
Django Best Practices: Imports
Imports are an inevitable part of Python and Django development. [Pep8](https://pep8.org/#imports), which is the official style guide for Python, recommends imports be placed at the top of the file, on … -
Django Best Practices: User permissions
Setting user permissions is a common part of most Django projects and can become quite complex quickly. We'll use the Blog example from my [Django for Beginners](http://djangoforbeginners.com) book as an … -
Django News - Real-time chat application in Django 4.2 with Server-Sent Events - May 19th 2023
News Django database defaults coming to 5.0 Lily Foote just added support for database defaults on fields. Coming to Django 5.0 in December. This is a massive effort--18 years after the ticket was created. Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for reviews. github.com Django Software Foundation Django 5.x Steering Council Election Results The Steering Council for the Django 5.x release cycle with 74 votes received out of 268 eligible voters: Simon Charette Andrew Godwin Adam Johnson James Bennett djangoproject.com Django Software Foundation monthly meeting, May 13, 2023 Meeting minutes for DSF Board monthly meeting, May 13, 2023. djangoproject.com Django Software Foundation May 2023 Grants A list of grants made by the DSF in support of the community for May 2023. djangoproject.com Sponsored Link Django for Beginners/APIs/Professionals Level up your Django knowledge with Django for Beginners, Django for APIs, or Django for Professionals, or gift it to a friend. Sample chapters are available to preview for free. Bundle discount available! learndjango.com Articles Writing a chat application in Django 4.2 using async StreamingHttpResponse, Server-Sent Events and PostgreSQL LISTEN/NOTIFY A very, very cool example of using "old" tech to solve new problems, aka using server-sent events, Psycopg3, and Django … -
Django REST Framework Authentication
This tutorial looks at how to add authentication to Django REST Framework with django-allauth and dj-rest-auth. -
New SaaS From Scratch - Building SaaS with Python and Django #160
In this episode, I started a brand new SaaS project from scratch. This new SaaS, a journal service, will allow users to journal via email and be provided with past posts as a engaging prompt. -
New SaaS From Scratch - Building SaaS #160
In this episode, I started a brand new SaaS project from scratch. This new SaaS, a journal service that will be at journeyinbox.com, will allow users to journal via email and be provided with past posts as a engaging prompt. -
Django Form Validation Guide
In this tutorial, I will talk about some ways to do form validation in Django, and compare them to help you choose the best way in your project. -
Giving It All Away: My Philanthropic Plan
A major personal accomplishment in 2022 – something I’m proud of – was creating a philanthropic framework. My wife and I intend to use this framework to guide our charitable giving for the rest of our lives, with the explicit goal of giving away almost all of our wealth in our lifetimes. Here’s some backstory, and all the details of our plan and the framework that guides our giving. -
Django News - DjangoCon Africa 2023 announced! - May 12th 2023
News Announcing DjangoCon Africa 2023 The African Django community is excited to announce the first DjangoCon Africa event, taking place this year in Zanzibar, Tanzania, from 6th - 11th November 2023. djangoproject.com DjangoCon US Call for Proposals - Ends May 15th! The CFP is open until May 15th. There are several posts listed in this issue with suggested talk topics. djangocon.us Python Software Foundation Board Election Dates for 2023 The Python Software Foundation Board election timeline has been posted for the 2023 election. There will be four seats open on the PSF board. blogspot.com Wagtail CMS Going Green with Google Summer of Code This year, Google Summer of Code has accepted two proposals from the Wagtail community. The team is excited to see what these collaborations will bring, following impressive contributions made in the past year. wagtail.org Meet Damilola Oladele, Our First Technical Writer for Google Season of Docs 2023 The Wagtail community welcomes its first technical writer, Damilola Oladele, through the Google Season of Docs (GSoD) program. This initiative aims to enhance and modernize Wagtail's developer documentation, making it easier for new community members to learn about the latest versions and features of Wagtail. wagtail.org Sponsored Link Sponsor Django … -
Django Admin ordered how you like
I got so tired and irritated by Django's alphabetical sorting of apps and models in the admin. def get_unordered_app_list(self, request): """ Return a list of all the installed apps that have been registered in this site in the order they were registered. """ app_dict = self._build_app_dict(request) app_list = app_dict.values() return app_list admin.AdminSite.get_app_list = get_unordered_app_list Post to Del.icio.us -
Django News - Django security releases: 4.2.1, 4.1.9, 3.2.19 - May 5th 2023
News Django security releases issued: 4.2.1, 4.1.9, and 3.2.19 The Django team announces the release of Django 4.2.1, Django 4.1.9, and Django 3.2.19, addressing a security issue and urging users to upgrade promptly. djangoproject.com Wagtail 5.0 is now available Featuring dark mode, more image options with SVG support, enhanced accessibility checker, and more. wagtail.org Sponsored Link Django for Beginners/APIs/Professionals Level up your Django knowledge with Django for Beginners, Django for APIs, or Django for Professionals, or gift it to a friend. Sample chapters are available to preview for free. Bundle discount available! learndjango.com Articles 3 Tips to Prepare Your Publisher Website for Traffic Spikes Some tips for how to prepare for your website going viral. lincolnloop.com Django for Beginners 4.2 Update What's new in the 4.2 edition update to the book, Django for Beginners. wsvincent.com CSRF and Trusted Origins in Django 4.x+ A quick note and advice on managing CSRF and Trusted Origins. noumenal.es How we added SVG support to Wagtail 5.0 Wagtail 5.0 to introduce SVG image support, sponsored by YouGov, with a detailed blog post on enabling the feature, security, and implementation insights. wagtail.org Events PyCon AU Call for Proposals The CFP is open until May 14th and … -
django CMS is a great toolbox
Here at Lincoln Loop, for the past 15 years, we have built countless Digital experiences (DXP) that help to move our customers’ digital transformation forward. The ultimate result of what is often a long-term engagement is often a code base that is composed of tens of thousands of lines of code that assemble and extend some key Python / Django components: django CMS django-filer The goal here is not to give you a long list of vetted dependencies but to tell you why these two components have been at the core of the solutions we have delivered multiple times. First, over the years, we learned how to scale this stack efficiently to millions of pageviews a day without worrying about going down every time content gets popular. Eight years ago, I wrote a book about it, High-performance django, with Peter Baumgartner. The secret is to do as little work as possible on every pageview and cache as many of the results as possible. However, this topic differs from the point I want to develop in this article. Why django CMS is a great toolbox Extend your models with a PlaceholderField One outstanding feature of django CMS is that it lends … -
Test and Code - Brian Okken
Test and Code podcast Python Testing with pytestDjango Testing Tutorial pytest-django Testing in Django: Official Docs awesome-django repo testing section PythonBytes 204 w/ Will and Carlton Support the ShowThis podcast does not have any ads or sponsors. To support the show, please consider purchasing a book, signing up for Button, or reading the Django News newsletter. -
Haproxy dummy backends: don't disable them in 2.2
We've got quite a number of different websites on different servers. We use a central haproxy server (well, two, for fail-over) to distribute the various domains to the (django) websites. There are two special categories I wanted to handle: Internal-only sites that are only available on our interal IP range. When accessed from elsewhere, you should get a "403" error with an error page saying it is an internal-only site plus a hint to use VPN. Domains that aren't found. A 404 with a "we don't know about this one" error message. With haproxy 2.2, which is the version we're using now on ubuntu 22.04, there's support for this with http return status 404 or something like that. Until two months ago, we were on an older ubuntu with haproxy 1.8. There the trick to accomplish it was to use dummy backends: backend no-domain-found # No servers here, it is used for showing the "404" page. Well, haproxy # knows no 404 itself, so we let the empty backend generate a 503, but we # sneakily return a 404 error page (including 404 header). See # https://serverfault.com/q/496460/52614 errorfile 503 /some/where/503-as-404.http disabled # Don't show it in the interface. backend deny-external … -
Weeknotes (2023 week 17)
Weeknotes (2023 week 17)Birthday Another year achieved. Feels the same as last year. I’m glad. feincms3-cookiecontrol I have released feincms3-cookiecontrol 1.3. Mostly cleanups since 1.2, but also a new translation (already announced here). The script size has been reduced from 4519 bytes to 4228 bytes (-6.5%) while keeping all features intact. The reduction is totally meaningless but it was fun to do. oEmbed I have been digging into the oEmbed spec a bit. I didn’t even know that a central list of providers exists. Noembed still works great to embed many different types of content but I worry more and more about its maintenance state. Reimplementing the interesting parts shouldn’t be that hard, but maybe I don’t have to do this myself. oEmbedPy looks nice, I hope I get a chance to play around with it. -
Django News - Django 5.x Technical Board Candidate Registration - Apr 28th 2023
News Django 5.x Technical Board Candidate Registration - Update An update on candidates for the Django Technical Board. djangoproject.com Introducing Python Package Index Organizations The Python Package Index (PyPI) adds Organizations. pypi.org urllib3 v2.0.0 is now generally available urllib3 is the most installed Python package of all time and, after 12 years, has finally moved from v1.0 to v2.0. sethmlarson.dev Articles How to have Python show warnings when running Django Two ways to see deprecation warnings when running your Django project. untangled.dev Using Django’s template loaders to configure Tailwind An elegant way to tell Tailwind where your Django templates are located. noumenal.es authentik on Django: 500% slower to run but 200% faster to build Debating the pros/cons of Django for building a startup. goauthentik.io sqlite-history: tracking changes to SQLite tables using triggers (also weeknotes) On the beginnings of a new project, sqlite-history, from Simon Willison. simonwillison.net Forum How many people actually use Argon2? The official docs have recommended its usage since Django 1.10, yet it's unclear how widely used it is in the real world. djangoproject.com Events DjangoCon Europe - Things to Do A helpful list of the many things to do nearby if you have some free time around … -
Python Exercises and Behind the Scenes - Building SaaS with Python and Django #159
In this episode, we covered more intro Python exercises from Exercism. Then I did some behind the scenes work to make some improvements to my stream content. -
Python Exercises and Behind the Scenes - Building SaaS #159
In this episode, we covered more intro Python exercises from Exercism. Then I did some behind the scenes work to make some improvements to my stream content.