25 Dec 2024

feedDjango community aggregator: Community blog posts

Why I still choose Django over Flask or FastAPI

I started using Django in 2009, and fifteen years later I am still a happy user. Why do I prefer it over Flask or FastAPI?

25 Dec 2024 5:59am GMT

20 Dec 2024

feedDjango community aggregator: Community blog posts

Weeknotes (2024 week 51)

Weeknotes (2024 week 51)

Building forms using Django

I last wrote about this topic in April. It has resurfaced on Mastodon this week. I'm thinking about writing a feincms3-forms demo app, but I already have too much on my plate. I think composing a forms builder on top of django-content-editor is the way to go, instead of replacing the admin interface altogether - sure, you can always do that, but it's so much less composable…

Releases

20 Dec 2024 6:00pm GMT

Django News - Django 6.x Steering Council Election Results - Dec 20th 2024

News

Django 6.x Steering Council Election Results

Congrats to our new Steering Council members.

djangoproject.com

Django Reached 100%+ Funding!

Django successfully reached its funding goal of $200,000 for 2024. It speaks to the volunteer-nature of the project that something with so many moving parts and active contributions can thrive on such a relatively limited budget.

djangoproject.com

Python Insider: Python 3.14.0 alpha 3 is out

This is an early developer preview of Python 3.14 featuring several major new features compared to Python 3.13.

blogspot.com

Django Software Foundation

Today 'Updates to Django' is presented by Velda Kiara from Djangonaut Space!

Last week we had 14 pull requests merged into Django by 11 different contributors - including 3 first-time contributors! Congratulations to Juan Pablo Mallarino, Ben Cardy, and amansharma612 for having their first commits merged into Django - welcome on board!🎉

Here are some highlights from the recent updates coming to Django 5.2:

Django Newsletter

Sponsored Link 1

Using server-side caching to speed up your applications, save on infra costs, and deliver better UX

If you've ever been floored by a sub-100ms response time, you've likely got caching to thank. Caching is the unsung hero of performance, shaving precious milliseconds off your application's response time by storing frequently accessed data, avoiding yet another round-trip request to the database or API.

Let's break down how caching works and explore a few common strategies.

sentry.io

Articles

New project to shorten django-admin to django because we are not monsters

Jeff proposed a third-party Python package called django-cli-no-admin, which shortens the django-admin command line script to just django.

webology.dev

How to show a modal in Django + HTMX

Learn how to display a Bootstrap modal using HTMX - no JavaScript required.

joshkaramuth.com

Object-based assets for Django's forms.Media

A streamlined approach to managing assets in Django forms using an object-oriented design, enhancing maintainability and flexibility.

406.ch

Django Quiz 2024

A fun annual quiz Adam Johnson conducted at the December edition of the Django London meetup.

adamj.eu

Lazy self-installing Python scripts with uv

Trey Hunner shares his current techniques for working with uv to manage dependencies.

treyhunner.com

Single-file Django Apps with nanodjango

The creator of nanodjango, explains more about his project to bring Flask-level simplicity to Django, without losing any of its power.

lincolnloop.com

Order, Tailwind, DRY · Applied Cartography

Justin from Buttondown explains his process for exfiltrating some higher-traffic, higher-leverage parts of Django's admin UI into some more bespoke components.

jmduke.com

Podcasts

Python Bytes Podcast Episode #414 Because we are not monsters

It's a Django-packed episode.

pythonbytes.fm

Django News Jobs

Full-stack Python Developer at Scalable Path 🆕

Full-Stack Web Engineer (Python/Django Specialist) at e180, inc

Remote Senior Django Full-Stack Developer (German speaking) at ImmoMetrica

Django Newsletter

Projects

OmenApps/django-tomselect

Autocomplete widgets and views using TomSelect.

github.com

inventree/InvenTree

Open Source Inventory Management System.

github.com


This RSS feed is published on https://django-news.com/. You can also subscribe via email.

20 Dec 2024 5:00pm GMT

Postgres To SQLite - Building SaaS #209.3

In this episode, the third portion of the stream covers how I migrated my Heroku-backed Postgres database to SQLite. I finished the migration of my app from running on Heroku to running on DigitalOcean.

20 Dec 2024 6:00am GMT

Docker Image For Kamal - Building SaaS #209.2

In this episode, the second portion of the stream worked on fixing up the Docker image so that we could get the DigitalOcean droplet functional. This is the second stream chunk because I was having network issues and the first stream cut out.

20 Dec 2024 6:00am GMT

Bootstrap Kamal On Droplet - Building SaaS #209.1

In this episode, I worked to finish the cloud migration to DigitalOcean for JourneyInbox. We started the stream by bootstrapping Kamal on the server. I hit network issues so this stream is split into multiple parts and is of lower quality than normal.

20 Dec 2024 6:00am GMT

18 Dec 2024

feedDjango community aggregator: Community blog posts

Object-based assets for Django's forms.Media

Object-based assets for Django's forms.Media

The pull request for adding object-based script media assets into Django is in a good state and I hope it will be merged soon. I have been using object-based assets long before Django actually added support for them in 4.1 (since 2016, that's before Django 1.10!) by using a gross hack. Luckily I have been able to clean up the code when Django 4.1 landed.

I have been asking myself at times why I haven't proposed the change to Django myself despite having been a user of something like this for such a long time. After all, I have been happily contributing issue reports, bug fixes and tests to Django. The process of adding new features sometimes is terribly frustrating though even when looking (and cheering) from the sidelines. It feels bad that adding another package to the list of packages I maintain so clearly seems to be the better way to get things done compared to proposing a new feature for Django itself. I hope processes change somewhat.

But I digress.

The ProseEditorWidget in django-prose-editor wants to ship CSS, JavaScript and some JSON to the browser for the widget. So, of course I used object-based media assets for this instead of widget HTML templates. Media assets are deduplicated and sorted by Django. If different editor presets use differing lists of assets they are smartly merged by forms.Media using a topological sort. You get those niceties for free when using forms.Media and everything just works, so what's not to like?

The only thing which isn't to like is that Django, at the time of writing, doesn't provide any classes helping with this. You can put strings into forms.Media or you can put objects with a __html__() method in there. The latter of course is all that's needed to support more advanced use cases - and that's exactly what django-js-asset now provides, and what django-prose-editor uses.

django-js-asset has long supported a JS class with support for additional attributes, for example:

from js_asset import JS

forms.Media(js=[
    JS("asset.js", {"id": "asset-script", "data-answer": "42"}),
])

Since 3.0 the package also comes with a CSS and JSON class:

from js_asset import CSS, JS, JSON

forms.Media(js=[
    JSON({"cfg": 42}, id="widget-cfg"),
    CSS("widget/style.css"),
    CSS("p{color:red;}", inline=True),
    JS("widget/script.js", {"type": "module"}),
])

This produces the following HTML:

<script id="widget-cfg" type="application/json">{"cfg": 42}</script>
<link rel="stylesheet" href="/static/widget/style.css">
<style>p{color:red;}</style>
<script src="/static/widget/script.js" type="module"></script>

The code which is proposed for Django supports the JavaScript use case but with a slightly different API:

forms.Media(js=[
    Script("widget/script.js", type="module"),
])

This looks slightly nicer as long as you don't use e.g. data attributes, because then you have to do:

forms.Media(js=[
    Script("widget/script.js", **{"data-cfg": ...}),
])

I always forget that Python supports passing keyword arguments names which aren't valid Python identifiers (but only when using **kwargs). I personally don't care much either way, and when my packages can finally drop compatibility with Django versions which do not support all these functionalities yet I'll finally be able to retire django-js-asset. That won't happen any time soon though, if only because I like supporting old versions of Django because I have so many Django-based websites running somewhere.

18 Dec 2024 6:00pm GMT

Django Quiz 2024

Yesterday, I held another quiz at the December edition of Django London. The quiz is a regular tradition at our meetup, a way of having a more relaxed event in December and giving away some nice prizes. This was the sixth quiz that I've presented, and the seventh overall.

Here's an action shot taken by my co-organizer Çağıl:

Me giving the quiz at Django London, 2024.

And below is the quiz itself, so you can try it at home. Answers follow at the end, with some extra explanation. Dates refer to December 2023, so if you're reading in the future, take that into consideration.

Enjoy!

The quiz

1. What is the default port that runserver uses?

  1. 8080
  2. 8000
  3. 8888
  4. 404

2. In which month of this year was Django 5.1 released?

  1. May
  2. August
  3. October
  4. Undecember

3. What company initially developed Django?

  1. Instagram
  2. Mozilla
  3. Lawrence Journal-World
  4. ACME Web Frameworks Inc.

4. What is the CSS selector that ORs a list of selectors?

  1. :is()
  2. :or()
  3. :any()
  4. :is-one-of-these()

5. What is the name of the new middleware that requires authentication by default?

  1. LoginRequiredMiddleware
  2. AuthenticationMiddleware
  3. PrivateEverywhereMiddleware
  4. FinallyNoMoreAccidentallyPublicViewsMiddleware

6. What is the name of the Django contributor accelerator program?

  1. Djangonaut Space
  2. Pony Express
  3. Astronaut Django
  4. All Djangoes Go

7. Which model field would you use to store unbounded textual data?

  1. CharField
  2. TextField
  3. BinaryField
  4. LongOrEvenInfiniteTextField

8. Which of these is not a real Django contributor team?

  1. Accessibility
  2. Oops
  3. Security
  4. Triage & Review

9. What is the new template tag to modify a URL's query parameters?

  1. {% alterqueryparams %}
  2. {% urlparams %}
  3. {% querystring %}
  4. {% q %}

10. Which class would extend to create a custom management command?

  1. BaseCommand
  2. ManagePyCommand
  3. AdminCommand
  4. Custom

11. In which city will DjangoCon Europe 2025 be held?

  1. Trondheim, Norway
  2. Porto, Portugal
  3. Dublin, Ireland
  4. Canberra, Australia

12. Which model class attribute contains the public API for metadata?

  1. _meta
  2. meta
  3. Meta
  4. metadata_please

Answers

But first, some vertical space.

A

N

S

W

E

R

S

B

E

L

O

W

Okay, now the answers

1. What is the default port that runserver uses?

The runserver command uses port 8000 by default.

2. In which month of this year was Django 5.1 released?

Django 5.1 was released in August.

3. What company initially developed Django?

Django was initially developed within Lawrence Journal-World, a daily newspaper in Lawrence, Kansas. See Simon Willison's history of Django post for the quite unusual story.

4. What is the CSS selector that ORs a list of selectors?

The CSS pseudo-class function that ORs a list of selectors is :is(). For example, to affect all icons within any heading element, <h1> through <h6>, you could use:

/* Icons in headings */
:is(h1, h2, h3, h4, h5, h6) .icon {
    margin-inline: 0.5em;
}

5. What is the name of the new middleware that requires authentication by default?

The new middleware that requires authentication by default is LoginRequiredMiddleware. A really useful feature that fixes a longstanding criticism of Django's security defaults. It is still opt-in, and will require many third-party packages to adapt their public views, but I'm excited.

6. What is the name of the Django contributor accelerator program?

The Django contributor accelerator program is called Djangonaut Space. They have done some amazing things helping new contributors get started with Django, and they even collectively won the Malcolm Tredinnick Memorial Prize last year.

7. Which model field would you use to store unbounded textual data?

To store unbounded textual data, use TextField. CharField has a limit, whilst TextField does not.

8. Which of these is not a real Django contributor team?

The team that is not a real Django contributor team is "Oops". It's actually "Ops", for operations-they keep the website and other infrastructure running!

9. What is the new template tag to modify a URL's query parameters?

The new-in-Django-5.1 template tag to modify a URL's query parameters is {% querystring %}. For example, you can use it like this when paginating:

<a href="{% querystring page=page.next_page_number %}">Next page</a>

If the URL was already /tech/?search=biscuits&page=1, the above would output a link where page was replaced with the next number:

<a href="/whatever/?search=biscuits&page=2">Next page</a>

10. Which class would extend to create a custom management command?

To create a custom management command, you would extend the BaseCommand class, per the custom management commands tutorial.

11. In which city will DjangoCon Europe 2025 be held?

DjangoCon Europe 2025 will be held in Dublin, Ireland. See you there?

12. Which model class attribute contains the public API for metadata?

The model class attribute that contains the public API for metadata is _meta, per the Model _meta API documentation. The underscore prefix is typically used in Python to mark things as "private" or "internal". In this case, Django had the API for some number of versions, third-party packages started using it, and so parts were formalized as public in Django 1.8.

Use this API to get details defined in internal Meta classes, like the plural verbose name:

>>> Octopus._meta.verbose_name_plural
'octopuses'

Fin

I hope you have enjoyed reading or doing this quiz. If you want more, see the previous years' quizzes in the "related posts" section below.

-Adam

18 Dec 2024 6:00am GMT

17 Dec 2024

feedDjango community aggregator: Community blog posts

Reflections on DjangoCon US 2024: Highlights, Takeaways, and Community Connections

DjangoCon 2024 was a resounding success for the community, with attendees from all over the world gathering to learn about the latest developments in Django and to connect with the Django community. Caktus was well-represented at the conference, with six of our team members attending. In this blog post, we share our experiences at DjangoCon 2024, including our favorite talks, the people we met, and the things we learned. We also offer some tips for future attendees on how to get the most out of DjangoCon.

What did you like most about DjangoCon 2024?

Keanya: What I loved most about DjangoCon 2024 was the people. DjangoCon is a celebration of community. I especially appreciated how welcoming the environment was. Whether you're a seasoned contributor or someone attending their first conference, you're made to feel like your voice matters. But the best part was the sense of connection. We are all here not just to write code, but to build something meaningful together.

Karen: Seeing and getting to catch up some with Django community folk that I only get to see maybe once or twice a year at DjangoCon events.

Tobias: For me, DjangoCon 2024 was my first US-based conference since the COVID-19 pandemic. The Django community has long been one of my favorite aspects of working with Django the framework, and I was grateful for the opportunity to catch up with a number of old friends from the Django community.

Jeanette: What I liked most about DjangoCon 2024 was how genuinely welcoming and community-driven it felt. I've attended many tech conferences since I became a software engineer in 2018, but DjangoCon's uniquely inclusive atmosphere encouraged me to connect with more people than I ever have at any other event.

Ronard: Seeing and sharing with many people from the Django community. By now, I've formed bonds with people that I met at my first DjangoCon, so it's great seeing them and catching up. Since I am remote, it's also a good opportunity to interact with my coworkers outside of work. Any tips for future attendees to get the most out of DjangoCon?

Keanya: Network Authentically - networking doesn't have to feel transactional. At DjangoCon, it's more about building meaningful connections. Ask people about their work, share your own journey, and find ways to collaborate or stay in touch after the event.

Karen: Submit a talk and present! Or volunteer to help out. Get involved so that you get to know people in the community individually and make a personal connection.

Tobias: While I know the "hallway track" is popular, I recommend attending talks in person whenever possible. It's easy to say you'll watch a talk video after the conference, but it might end up being difficult to find time. Plus, it's motivating for speakers when people show up to their talks!

Jeanette: Try to get involved early by joining the official Slack community or following Django blog for updates. Also, don't hesitate to participate in the sprints that DjangoCon hosts to get a chance to collaborate with your peers on bug fixes, improving documentation, or brainstorming new features.

Ronard: Talk to as many people as you possibly can. Everyone is nice, welcoming, and loves talking about tech. Just like F1 drivers can't help but talk about tires, developers can't help but talk tech, especially with those who share our love and passion.

What was your favorite talk at DjangoCon 2024?

Keanya: My favorite talk was Power to the people who teach the people by Keynote speaker Sheena O'Connell. Her perspective on teaching resonated with me. She emphasized the importance of empowering learners and creating an environment that encourages curiosity and growth. Sheena's take on fostering a growth mindset-believing in your ability to learn and improve-was both inspiring and energizing.

Karen: An Opinionated Guide to Modern Django Forms by Josh Thomas, somewhat selfishly since I love how it covers the detailed code examples I was unable to fit in my own talk "Django + Alpine.js + htmx Ups and Downs". I was excited to be able to point people at my talk to this one for an excellent talk that had code examples of how to use the technologies I was discussing.

Tobias: I really enjoyed Sheena O'Connell's keynote, Power to the People who Teach the People. It goes into detail on learning and teaching strategies in tech, and helped me personally think through how I can push boundaries to help myself and others on my team grow and learn.

Jeanette: I loved "Choosing Wisely: SPA vs. HTMX for Your Next Web Project" by Chris May. As a frontend software engineer, this topic resonated deeply with me! My favorite part was the case studies where Chris showcased real-world examples of companies improving performance and productivity by switching from SPAs to HTMX and Alpine.js. The stories highlighted how thoughtful architectural decisions can simplify development, boost team efficiency, and enhance user experience-all while reducing complexity!

Ronard: I really enjoyed "API Maybe: Bootstrapping a Web Application circa 2024" by Carlton Gibson. Carlton is a fantastic story teller and he used his skills to make a great case for why Django is as relevant today as it's even been, if not even more relevant. Django's simplicity continues to shine as its superpower, especially with the aid of newer technologies.

What did you take away from DjangoCon that you are using right now at Caktus?

Keanya: Sheena's passion for teaching made me excited to dive deeper into my own learning journey. She inspired me to take one of her workshops. "Modern Front-end development with Python, Htmx and Friends.

Karen: It's still a work in progress, but I'm trying to apply the lessons of the Error Culture talk by Ryan Cheley to the projects I work on. I long for a day where I'm supporting several projects and all "alerts [...] are meaningful, actionable, and directed at the appropriate recipients".

Tobias: While I'm not using them yet, I've become a huge fan of URL path converters and I hope to start using them on more projects soon. Willem Van Onsem's talk, path('/user//', view_profile) provided a great introduction.

Jeanette: One of my biggest takeaways from DjangoCon 2024 was the meaningful connections I made within the Black Python Devs community. I also had the unforgettable experience of watching my sister and colleague, Keanya Phelps, speak on a panel, which inspired me to step out of my comfort zone and submit two talk proposals for DjangoCon 2025 in Dublin, Ireland. Seeing her confidently share her expertise motivated me to share my own knowledge and contribute more actively to the Django community.

Ronard: Nothing at Caktus, but Will Vincent's time-lapse of the Django user model helped me with mentally architectingarchiteching some decisions for an open-source project. It was insightfulinsigthful hearing about how the user model has changed and the many options we still have as Django developers. DjangoCon has been a long-time favorite conference for the Caktus team. DjangoCon was exceptional due to the high quality of talks, the intimate and communal atmosphere, and the friendliness of the attendees. This combination made the conference enjoyable and memorable. We hope to see you at DjangoCon 2025!

17 Dec 2024 5:00am GMT

14 Dec 2024

feedDjango community aggregator: Community blog posts

HTTPS for Django Development Environment

Certain modern website features require HTTPS, including Progressive Web Apps (PWA), WebSockets, camera and microphone usage, and geolocation detection. However, the default Django runserver command can only run the web server under HTTP. Is it possible to have HTTPS in your local development environment? Surely, and in this article, I will guide you through how to set it up.

How TLS/SSL certificates work

First of all, let's have a common ground on how the HTTPS work.

HTTPS is what makes websites secure, protecting transferred visitors' data (like passwords or credit card info).

TLS (Transport Layer Security), which replaced SSL (Secure Sockets Layer), is the security tool that works behind the scenes to create the safe connection between a client (like a browser) and a server by encrypting the data exchanged.

They work using a public key (shared via the certificate) and a private key (kept secret by the server) to establish encrypted connections. These keys are often stored in BASE64-encoded files with extensions like .pem.

A Certificate Authority (CA) is a trusted organization or entity responsible for issuing and managing digital certificates used in TLS/SSL encryption. Trusted Certificate Authorities verify the identity of website owners and sign their certificates to ensure authenticity.

A trusted Certificate Authority signs the certificate to verify the server's identity, and clients (like the browswes) validate it against the Certificate Authority's root certificate to ensure the connection is authentic and secure. The CA root certificates are typically stored in the operating system or the browser and updated regularly with software updates.

Some well-known Certificate Authorities include:

For local development, one can use a simple tool mkcert to create locally trusted TLS certificates to secure development environments without needing external Certificate Authorities. Soon, you'll see how to do that.

TLS/SSL certificates are used not only for HTTPS connections but also to secure other communication protocols, including WebSockets (wss://), FTPS, database connections, email protocols (SMTP, IMAP, POP3), and message brokers (e.g., Redis, RabbitMQ, Kafka).

1. The /etc/hosts file

I usually create local hostnames for my development environments to access them by domains, such as djangotricks.local instead of localhost or 127.0.0.1. This can be done by adding a mapping line to your /etc/hosts file:

127.0.0.1 djangotricks.local

2. Install mkcert

Let's install mkcert to your development environment. I used Homebrew with the following commands on macOS:

$ brew install mkcert
$ brew install nss  # for Firefox
$ mkcert -install

Installation instructions for other operating systems are available at the mkcert GitHub page.

3. Create certificates for your local domain

I made a directory certs in my Django project, changed the current directory to it, and then ran:

mkcert djangotricks.local

Afterwards, I created .gitignore file in it with the following content that ignores everything but itself:

*
!.gitignore

Finally, my project's file structure looked like this:

djangotricks/
├── certs/
│   ├── .gitignore
│   ├── djangotricks.local.pem  - public certificate
│   ├── djangotricks.local-key.pem  - private key
├── manage.py

4. Django settings

I added a few TLS-related settings to my development-environment settings file at djangotricks/settings/dev.py:

CSRF_TRUSTED_ORIGINS = [
    "https://djangotricks.local:8000",
    "http://djangotricks.local:8000",
]

CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True

5.a) Create a custom script for the WSGI server

The next step was to prepare scripts for running the web server under HTTPS. After a few iterations of chatting with Claude AI, I created a file run_https_wsgi_server.py with the following content:

import os
import ssl
from pathlib import Path
from django.core.servers.basehttp import get_internal_wsgi_application
from wsgiref.simple_server import make_server
from watchfiles import run_process

def run_server():
    # Set Django environment
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangotricks.settings.dev")
    application = get_internal_wsgi_application()

    # Set certificate paths
    cert_path = Path(__file__).parent / "certs"
    ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
    ssl_context.load_cert_chain(
        certfile=cert_path / "djangotricks.local.pem",
        keyfile=cert_path / "djangotricks.local-key.pem",
    )

    # Run server with TLS
    with make_server("djangotricks.local", 8000, application) as httpd:
        httpd.socket = ssl_context.wrap_socket(httpd.socket, server_side=True)
        print("Serving on https://djangotricks.local:8000")
        try:
            httpd.serve_forever()
        except KeyboardInterrupt:
            print("Server stopped.")

if __name__ == "__main__":
    # Watch directories for changes
    watched_dirs = [
        str(Path(__file__).parent), # Current directory
    ]

    # Start watching and run the server with auto-reload
    run_process(
        *watched_dirs,            # Paths to watch
        target=run_server,        # Function to run
        debounce=1600,            # Debounce changes (milliseconds)
        recursive=True,           # Watch directories recursively
        debug=True                # Enable debug logging
    )    

This Python script runs Python's default web server with the Django WSGI under HTTPS, watches the project files for changes, and restarts the server whenever something is updated.

Then I installed the dependency watchfiles, which is a Rust-powered watcher for file changes:

(venv)$ pip install watchfiles

That allowed me to run the web server script with:

(venv)$ python run_https_wsgi_server.py

5.b) Create a custom script for the ASGI server

Analogically, I created a script for running the web server under HTTPS with ASGI support. It uses uvicorn for the ASGI protocol and watchfiles for automatic reloading:

(venv)$ pip install uvicorn
(venv)$ pip install watchfiles

I named the script run_https_asgi_server.py and it had the following content:

import os
from pathlib import Path
import uvicorn

if __name__ == "__main__":
    # Set Django environment
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangotricks.settings.dev")

    # Set certificate paths
    project_root = Path(__file__).parent
    ssl_keyfile = project_root / "certs" / "djangotricks.local-key.pem"
    ssl_certfile = project_root / "certs" / "djangotricks.local.pem"

    # Run server with TLS
    uvicorn.run(
        "djangotricks.asgi:application",
        host="djangotricks.local",
        port=8000,
        ssl_keyfile=str(ssl_keyfile),
        ssl_certfile=str(ssl_certfile),
        reload=True,  # Enable autoreload
        reload_dirs=[
            str(project_root),
        ],
        reload_includes=["*.py", "*.html", "*.js", "*.css", "*.txt"],
        workers=1,
    )

Uvicorn's core features include integration of' watch files` and TLS/SSL support. Developers can define which directories and file types to watch for autoloading.

Lastly, I could run the script with:

(venv)$ python run_https_asgi_server.py

6. Test your server

To test my results, I navigated to https://djangotricks.local:8000, browsed all the main pages, tried to submit a form, tried an asynchronous view, tried one of the modern JavaScript features, and tried changing some HTML markup to see how the web server automatically restarts for the changes to take effect immediately.

Conclusion

HTTPS is an essential feature of modern web development, and it's absolutely necessary to be able to set it up in development environments.

Tools like mkcert make it possible to use TLS certificates locally.

Although Django's runserver doesn't yet support TLS/SSL certificates, you can create custom Python (or Bash) scripts to run the web servers with HTTPS and autoloading. Also, it is quite straightforward to remove the autoloading if you don't need it.

Now, it's time for me to update all my local development environments. For you, too?


Cover picture by Laura Gigch

14 Dec 2024 9:06pm GMT

13 Dec 2024

feedDjango community aggregator: Community blog posts

Django News - Django 6.x Steering Council Candidates - Dec 13th 2024

News

Django 6.x Steering Council Candidates

There are 12 individuals who have chosen to stand for election and written statements of intent. Existing individual members are eligible to vote.

Voting is open until 23:59 on December 17, 2024 Anywhere on Earth.

djangoproject.com

PSF Fellow Membership: Welcome 2024 Q3 Fellow Members!

Congratulations to fellow Djangonauts Jay Miller, Kojo Idrissa, and Trey Hunner, who are now Python Fellows.

python.org

Django Software Foundation

DSF Board monthly meeting, December 10, 2024

Meeting minutes for DSF Board monthly meeting, December 10, 2024.

djangoproject.com

My first DSF board meeting

New DSF Board Member Paolo Melchiorre describes his first meeting and a behind-the-scenes peak at how Django is actually run.

paulox.net

Updates to Django

Today 'Updates to Django' is presented by Velda Kiara from Djangonaut Space!

Last week we had 20 pull requests merged into Django by 15 different contributors - including 3 first-time contributors! Congratulations to Oleg Sverdlov, Ülgen Sarıkavak, and Joel Burns for having their first commits merged into Django - welcome on board!

The following security issues have been addressed:

The affected versions are: Django main, Django 5.1, Django 5.0 and Django 4.2. You are encouraged to upgrade as soon as possible.

Other updates include: added id to ErrorList class and template for 5.2, and restored refreshing of relations when fields deferred in 5.1.4.

Django Newsletter

Wagtail CMS

Gauging Community Interest: Wagtail Space 2025

The Wagtail Space organization teams are considering having a joint (US & Europe) Wagtail Space 2025 in Iceland. Before we commit to this idea, we need to have a better idea of interest. Please let us know if you can attend, and what you are interested in.

google.com

Sponsored Link 1

The #1 Django Podcast

Since 2019, Django Chat is a biweekly podcast covering the people and news behind Django. Hosted by former Django Fellow Carlton Gibson and LearnDjango founder Will Vincent.

djangochat.com

Articles

Using a temporary directory inside a Django test

A quick solution to an issue involving storages and staticfiles during tests.

bmispelon.rocks

Django: launch pdb when a given SQL query runs

From Adam Johnson, another technique for using pdb within Django.

adamj.eu

Building a Chat Backend for Wikipedia Articles in Django

A tutorial on setting up a content-aware chatbot powered by Wikipedia with a Django backend.

lincolnloop.com

The Ultimate Guide to Django Performance: Best Practices for Scaling and Optimization

A very comprehensive guide to boosting performance in your Django app.

loadforge.com

A Comprehensive Guide to Python Project Management and Packaging: Concepts Illustrated with uv - Part I

The goal of this guide is to provide a comprehensive guide to Python project management and packaging, and it certainly does.

reinforcedknowledge.com

Videos

DjangoCon US 2024 Videos

DjangoCon US 2024 Videos are live. Again!

djangotv.com

Sponsored Link 2

YOUR AD HERE

Our newsletter has a large and engaged audience of active email subscribers and an impressive open (59%) and click rate (29%). Django News has availability this quarter for single week ads or bundle deals.

django-news.com

Podcasts

Django Chat #172: pretix with Raphael Michel

Raphael is the founder of pretix, an open-source ticketing platform. We discuss its early iterations, the technical challenges of ticketing, using Celery and Django REST Framework, DecimalField vs IntegerField for currency, and more.

djangochat.com

Django News Jobs

Lead Engineer at Blenheim Chalcot 🆕

Full-Stack Web Engineer (Python/Django Specialist) at e180, inc

Remote Senior Django Full-Stack Developer (German speaking) at ImmoMetrica

Django Newsletter

Projects

JohananOppongAmoateng/AccessibleDjango

Contribute to JohananOppongAmoateng/AccessibleDjango development by creating an account on GitHub.

github.com

hypy13/django-daisy: A modern django dashboard built with daisyui

A modern django dashboard built with daisyui. Contribute to hypy13/django-daisy development by creating an account on GitHub.

github.com


This RSS feed is published on https://django-news.com/. You can also subscribe via email.

13 Dec 2024 5:00pm GMT

1Password and DigitalOcean Droplet - Building SaaS #208

In this episode, I continued a migration of my JourneyInbox app from Heroku to DigitalOcean. We configured the secrets using 1Password and created the droplet that will host the app.

13 Dec 2024 6:00am GMT

12 Dec 2024

feedDjango community aggregator: Community blog posts

UV and Ruff: Next-gen Python Tooling

Dive into the dynamic duo of modern Python development - UV and Ruff!

12 Dec 2024 6:00am GMT

11 Dec 2024

feedDjango community aggregator: Community blog posts

pretix - Raphael Michel

Sponsors

11 Dec 2024 6:00pm GMT

My first DSF board meeting

Thoughts and insights aboutr my first meeting as a Django Software Foundation board member.

11 Dec 2024 5:00am GMT

10 Dec 2024

feedDjango community aggregator: Community blog posts

Thinking About Risk: Mitigation

So you've identified a risk - now what do you do about it? Here's a simple framework to help frame discussions about risk mitigation. It's intentionally very simple, a basic starting point. I'll present a more complex framework later in this series, but I want to lay more of a foundation before I get there, so we'll start here.

10 Dec 2024 6:00am GMT