Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Here, There, Middleware
Full show notes are available at https://www.mattlayman.com/django-riffs/11. -
Episode 11 - Here, There, Middleware
On this episode, we will investigate Django middleware and see where it goes in your project. In the process, you’ll see why middleware is useful and how you can work with it. Listen at djangoriffs.com. Last Episode On the last episode, we’re going to look at working with users in a Django project. We’ll see Django’s tools for identifying users and checking what those users are permitted to do on your website. -
Bringing Security along on the CI/CD journey
Practical ways to bridge the gap between AppSec and Engineering. -
Using MinIO to upload to a local S3 bucket in Django
Hi everyone! Some weeks ago I was doing a demo to my teammates, and one of the things that was more suprising for them was that I was able to do S3 uploads locally using “MinIO”. Let me set the stage: Imagine you have a Django ImageField which uploads a picture to a AWS S3 bucket. How do you setup your local development environment without using a “development” AWS S3 Bucket? -
Using MinIO to upload to a local S3 bucket in Django
Hi everyone! Some weeks ago I was doing a demo to my teammates, and one of the things that was more suprising for them was that I was able to do S3 uploads locally using “MinIO”. Let me set the stage: Imagine you have a Django ImageField which uploads a picture to a AWS S3 bucket. How do you setup your local development environment without using a “development” AWS S3 Bucket? For that, we use MinIO. What is MinIO? According to their GitHub README: > MinIO is a High Performance Object Storage released under Apache License v2.0. It is API compatible with Amazon S3 cloud storage service. So MinIO its an object storage that uses the same API as S3, which means that we can use the same S3 compatible libraries in Python, like Boto3 and django-storages. The setup Here’s the docker-compose configuration for my django app: version: "3" services: app: build: context: . volumes: - ./app:/app ports: - 8000:8000 depends_on: - minio command: > sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000" minio: image: minio/minio ports: - 9000:9000 environment: - MINIO_ACCESS_KEY=access-key - MINIO_SECRET_KEY=secret-key command: server /export createbuckets: image: minio/mc depends_on: - minio entrypoint: > /bin/sh -c " … -
About Print Versions of "A Wedge of Django"
Due to a never ending set of logistical issues for the print versions of our Django Crash Course, A Wedge of Django, we have decided to cancel our attempt to handle printing it ourselves. This will free us up in order to finish it, as well as other books. If you pre-ordered a print version of this book we have sent out emails asking if you want a refund or discount code for other purchases on this site, including the e-book version of Two Scoops of Django. If you have not received this email and pre-ordered the book, please contact us at hi @ feldroy.com. Finally, there is a significant possibility we will use Amazon's print-on-demand service to publish the book, in which case it will have to be purchased as an Amazon product. Sincerely,Daniel, Audrey, and Uma -
Django News - Django 3.1.5 release - Jan 8th 2021
News Django bugfix release: 3.1.5 A new bugfix release is out. As ever, staying on the latest version of Django is the #1 security step you can take on your projects. Here are the revelant docs for doing so. djangoproject.com htmx 1.1.0 Release htmx is a promising new library that adds support for AJAX, CSS Transitions, WebSockets, and Server Sent Events directly in HTML. htmx.org Events Python Web Conf 2021 CFP The CFP closes on January 29, 2021. papercall.io Articles My Python linting setup in 2020 :: sleepy yaks industries — Help teams delivering better products and applications Linting is an automated style guide for personal or team use. Here's one approach for 2020 and beyond. yaks.industries Better Exception Output in Django’s Test Runner With better-exceptions Adding the better-exception package to Django's test runner which makes the standard assert statement much more usable. adamj.eu Designing Engineering Organizations From Jacob Kaplan-Moss, a look at how to structure a larger engineering organizations. jacobian.org Using Django & AssemblyAI for More Accurate Twilio Call Transcriptions In this tutorial, we'll record an outbound Twilio call recording to AssemblyAI's API to get significantly more accurate speech-to-text output. fullstackpython.com Understand Django: Serving Static Files The 11th in … -
Testing Email Designs - Building SaaS #86
In this episode, I worked on the sign up confirmation email design. We customized the template and used MailHog to test the flow and see how the email appeared. After working on the email design, we switched to the landing page of the site to work on the pricing information. I started the stream by explaining that I’m working through some final tasks before launching the app more publicly. I covered why I am planning to send a sign up email and why I want to customize it. -
Telemedicine - Matt Layman
Matt’s personal siteDjango Riffs PodcastDoctor on DemandMatt on YouTubeMatt on TwitchMatt on TwitterPyCon 2015: James Bennett on the Django ORMSupport the ShowThis podcast is a labor of love and does not have any ads or sponsors. To support the show, consider purchasing or recommending a book from LearnDjango.com or signing up for the free weekly Django News newsletter. -
Serving Static Files
In the previous Understand Django article, I described how Django gives us tools to run code for any request using the middleware system. Our next focus will be on static files. Static files are vital to your application, but they have little to do with Python code. We’ll see what they are and what they do. From Browser To DjangoURLs Lead The WayViews On ViewsTemplates For User InterfacesUser Interaction With FormsStore Data With ModelsAdminister All The ThingsAnatomy Of An ApplicationUser AuthenticationMiddleware Do You Go? -
Our Top 20 Blogs in 2020
We’ve published summaries of our most popular blog posts before (see Top 19 of 2019 and Top 18 of 2018), but this time, we’re taking it a step further. We’re sharing the 20 most popular posts in 2020, regardless of the year the post was originally published. And some of these have been around a while! Based on total pageviews, here are the blogs that rose to the top of the popularity list, from most viewed to least viewed. Most Popular Blogs in 2020 1. Creating Dynamic Forms with Django: Published May 7, 2018 2. Here's a Production-Ready Dockerfile for Your Python/Django App: Published March 14, 2017 3. CSS Tip: Fixed Headers and Section Anchors: Published October 23, 2017 4. A Guide To Creating An API Endpoint With Django Rest Framework: Published February 1, 2019 5. How to Use Django Bulk Inserts for Greater Efficiency: Published January 9, 2019 6. Filtering and Pagination with Django: Published October 18, 2018 7. Using Amazon S3 to Store your Django Site's Static and Media Files: Published November 10, 2014 8. How to Import Multiple Excel Sheets in Pandas: Published August 13, 2019 9. Django vs WordPress: How to Decide?: Published August 14, 2018 … -
How to Set Up report-uri.com on Django
In recent years browsers have gained many powers to report back problems they encounter on your site, such as: Network Error Logging (NEL) can report bad HTTP statuses, expired TLS certificates, etc. Content Security Policy can report banned resources found on your site. Deprecation reports can tell you that you’re using web API’s that will soon be removed. Browsers send these reports to URI’s listed in specific security headers, including the exiperimental Report-To header. These are really useful since they can uncover issues that would otherwise go unseen. A service for collecting, parsing, and making sense of these reports is report-uri.com. It’s run by Scott Helme a security researcher who also made the useful free tool securityheaders.com. It makes a lot of sense to use a separate service for receiving browser reports, since if you have a problem on your own site, it’s likely you’d have problems collecting the reports too! Yesterday I set up report-uri.com on my new Django project db-buddy.com. Here’s how I did it. Note: I added the headers from within Django. This makes sense for me since I’m deploying on Heroku and serve all URL’s from Django, including static assets via Whitenoise. If your site is … -
Designing Engineering Organizations
How should you structure a larger engineering organization, one with dozens (or hundreds) of engineers? There are many tradeoffs to consider, and no single right answer. But, there are some structures that work better than others. -
Better Exception Output in Django’s Test Runner With better-exceptions
Today I learned about the better-exceptions pacakage. It makes exception output better, providing more context and colourization on the terminal. If you’re using Django’s test framework, you can install better-exceptions during your test runs. It makes it the plain assert statement much more usable. Plain asserts are clearer to write and read than the various self.assert* functions, so a definite win for tests. pytest’s assert statement rewriting is similar to better-exceptions, and it’s definitely a “killer feature” for pytest users. Whilst I recommend pytest, it can be hard to port existing projects, so using better-exceptions is a nice compromise. Adding better-exceptions To Django Test Runs First, you’ll want a custom test runner class. If you don’t already have one, create one as below, in a file like example/test.py. Inside that the test runner’s run_tests() method, you can use a monkey-patch to install better-exceptions into the unittest TestResult class, which is responsible for output of tests. There’s a snippet in the better-exceptions documentation, which I’ve made Python-3-only. Putting it all together: from unittest.result import TestResult import better_exceptions from django.test.runner import DiscoverRunner class ExampleTestRunner(DiscoverRunner): def run_tests(self, *args, **kwargs): # Enable better-exceptions for better display of exceptions # https://github.com/Qix-/better-exceptions#use-with-unittest def exc_info_to_string(self, err, test): … -
How to Override the gunicorn Server Header
In all current releases of the popular WSGI server gunicorn, the Server header reports the complete version of gunicorn. I spotted this on my new project DB Buddy. For example, with httpie to check the response headers: $ http https://db-buddy.herokuapp.com -ph HTTP/1.1 200 OK ... Server: gunicorn/20.0.4 ... Reporting the version of server software is not recommended as it is a security risk. Fastly list Server and other vanity headers first in their article The headers we don’t want. In many setups, gunicorn’s Server header will be overwritten. For example if you’re using Nginx, it will replace Server with its own version (disable that with its server_tokens directive). But my app is running on Heroku which preserves the gunicorn Server header. Because of the security risk, there has been a long ongoing gunicorn issue to remove the version from the gunicorn header, leaving it as Server: gunicorn. The Pull Request to remove the version was merged nearly a year ago but is still pending release. Until then, we can use the workaround suggested in the original issue: monkey-patch the SERVER_SOFTWARE attribute that gunicorn uses to fill in the Server header. I’m configuring gunicorn with a submodule of my app’s package, … -
Happy new years 2021! Evennia things to come this year
Another year passed with Evennia, the Python MU* creation system. The past year saw a lot of bug fixing and more gradual additions and in September we released version 0.9.5. This was an intermediary version on our way to 1.0. Time to look forward to next year. On my development horizon for 2021 are the main new features planned for v1.0. Some of these are rather big things I've wanted to get around to for a while. They are all happening in the develop branch of Evennia, which is currently not recommended for general use.SessionDB: In the current Evennia, Sessions (the representation of a single client connection) is an in-memory entity. This is changing to be a database-backed entity instead. One will be able to typeclass Sessions like other entities for easier overriding. This change also means that there will be one single point of session-id (the django-session), alleviating some reported issues where the Portal- and Server-side sessions have drifted out of sync. It will also make it a lot easier to support auto-logins, also across server reboots. Db-backed Sessions will also simplify the Portal-Session interaction a lot. Script refactor: The Scripts will see some refactoring, mainly because they are used more as … -
Django News - 2020 Year-in-Review - Jan 1st 2021
Introduction 2020 in Review Thanks to all of our newsletter subscribers. We grew to over 1,500 readers and an average open rate of 63%+ which is considered very high for newsletters. We're looking forward to 2021 and continuing to provide news, articles, and projects in the Django community. django-news.com News 2020 Malcolm Tredinnick Memorial Prize awarded to Ken Whitesell Ken Whitesell was awarded the 2020 Malcolm Tredinnick Memorial Prize for his many contributions to the Django community. This year we received the highest number of nominations ever received for the Malcolm Tredinnick Memorial Price with some being nominated twice, three times, and the highest being six times. djangoproject.com Channels security release issued: 3.0.3 Channels 3.0.3 is a security release and we encourage all users of Channels to upgrade as soon as possible. djangoproject.com Django News newsletter sponsorship If you'd like to reach 1,500+ engaged Django developers with news, projects, job listings, and more consider sponsoring our newsletter. Rates and availability are all online. django-news.com Articles Django Best Practices: Security The most-clicked article was by Will on Security, providing a list of top factors to consider in any Django project and tips for locking-down security. learndjango.com Docker & Django local development: … -
Customer Docs - Building SaaS #85
In this episode, I integrated customer documentation into the app. I showed how to build Sphinx documentation into a Django project, then created a help view to link to the docs. Finally, I added documentation building to the deployment process. I previously created a Sphinx documentation project to hold docs for my app, but I had not hooked the docs into my project yet. Before hooking it in, I explained how Sphinx works and how I customized the documentation to fit with my project. -
Continuous Delivery in an Agile World
This article looks at what Continuous Delivery is, why it's a competitive advantage, and what the process looks like. -
AI is catching up to the hype
One of the major trends I’ve been thinking about a lot this year is that the reality of AI has starting catching up to the hype. This thought has been percolating in my brain for a while, and finally bubbled out into a comment on MetaFilter. I’m publishing it here, as well. -
Django News - GeoDjango and Hotwire! - Dec 24th 2020
News Python Release Python 3.8.7 Python 3.8.7 is a bugfix release. python.org Hotwire: HTML Over The Wire Hotwire is an alternative approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over the wire. The Basecamp folks put up a marketing website announcing some new OSS tools which promote sending HTML instead of JSON over the wire. hotwire.dev Django Backend Support for Hotwire Discussion If you are curious about how to use Hotwire with Django, checkout this discussion. hotwire.dev Events PyCon Us 2021 Call for Proposals is Open! PyCon US 2021 will be virtual but the call for proposals is open now until February 12, 2021. blogspot.com Articles Creating Custom Postgres Data Types in Django Some tips on creating new data types in Postgres and bringing them into a Django application. pganalyze.com How to Mock the Current Date and Time in Python by Adam Johnson If you’re testing Python code that relies on the current date or time, you will probably want to mock time to test different scenarios but doing so isn't that easy. Adam Johnson shares some tips on how to overcome this. adamj.eu Learn about ghapi, a new third-party Python client … -
Web Authentication Methods Compared
This article looks at the most commonly used web authentication methods. -
Search & GeoDjango - Paolo Melchiorre
Paolo’s personal website20tabGithub profileTwitter profileDjangoCon Europe 2020 - A Pythonic Full-Text SearchDjangoCon Europe 2019 - Maps with GeoDjango, PostGIS and LeafletFull-Text Search in Django with PostgreSQLWorld Food ProgramMaps with Django (part 1): GeoDjango, SpatiaLite and LeafletSupport the ShowThis podcast is a labor of love and does not have any ads or sponsors. To support the show, consider purchasing or recommending a book from LearnDjango.com or signing up for the free weekly Django News newsletter. -
Refactoring Enrollment - Building SaaS #84
In this episode, I decided to redesign a portion of the application flow. I wasn’t pleased with how users would enroll students for their grades so I refactored the school year page into a flow that worked better. Note: My internet connection was not good during this stream. Thankfully, the audio is fine and reading code is very possible because the background doesn’t need to change much. My apologies for the low quality. -
Django Chat - E81
A podcast on the Django Web Framework by William Vincent and Carlton Gibson.