Best of DjangoSeptember 2024

  1. 1
    Article
    Avatar of jetbrainsJetBrains·2y

    Django Project Ideas

    Get inspired with a range of Django project ideas, from simple beginner apps to more advanced, full-stack applications. Learn how to set up a Django project, develop models, views, and templates, and explore various tech stacks for each project. Ideal for building a personal project, enhancing your portfolio, or experimenting with new technologies.

  2. 2
    Article
    Avatar of hnHacker News·2y

    Taming the beast that is the Django ORM - An introduction

    This post provides an introduction to the Django ORM, emphasizing its strengths and weaknesses. It covers the basics of object-relational mapping, the reasons for using an ORM, potential pitfalls like lazy loading and N+1 queries, and provides guidance on migrations, querying, and performance improvements. It also details the differences between raw SQL and how Django ORM handles various SQL operations.

  3. 3
    Video
    Avatar of coreymsCorey Schafer·2y

    Python Tutorial: Pathlib - The Modern Way to Handle File Paths

    Learn about Python's pathlib module introduced in Python 3.4, a modern alternative to the OS module for handling file paths. Pathlib represents paths as objects, making file operations more intuitive and less error-prone across different operating systems. The tutorial provides practical examples and contrasts the usage of pathlib versus the OS module, explaining the benefits of switching to pathlib for better readability and efficiency. Additionally, the tutorial covers pathlib's methods for creating, deleting, and modifying files and directories, with guidance on when to use the OS or shutil modules instead.

  4. 4
    Article
    Avatar of adamjAdam Johnson·2y

    Django: build a Microsoft Teams bot

    Building a Microsoft Teams bot in Django is challenging due to issues such as convoluted documentation, a fragmented Bot Framework Python package, and limited helpful sample apps. Despite these obstacles, the bot can be configured and tested, with alternatives like the Teams Developer Portal simplifying some aspects. Key steps include handling incoming webhook messages, managing channel names, and navigating Adaptive Cards for message formatting. A single-file Django example and related tests are provided to get started.

  5. 5
    Video
    Avatar of communityCommunity Picks·2y

    Django (Python) vs Stdlib (Go): Performance Benchmark in Kubernetes #209

    The post compares the performance of a Django (Python) application and a Go application using the standard library in a Kubernetes environment. It examines key metrics such as CPU usage, memory usage, availability, latency, and network pressure under various loads. The tests include scenarios like returning JSON responses and uploading files to S3 while saving metadata to a PostgreSQL database. Go generally shows lower latency and higher request handling capacity compared to Django, but both have specific strengths and weaknesses under different conditions.

  6. 6
    Article
    Avatar of sentrySentry Engineering·2y

    Splitting production databases with minimal downtime

    At Sentry, Postgres is used as the relational datastore, and it has been scaled both vertically and horizontally. The application leverages product area sharding to isolate infrastructure and minimize failure impact. Django's ORM with database routers supports multiple database configurations and seamless transactional operations. The process involves analyzing and adjusting foreign key constraints, updating `pgbouncer` configurations, and ensuring logical and physical separation of databases to meet growing demands.

  7. 7
    Article
    Avatar of adamjAdam Johnson·2y

    Django: a pattern for settings-configured API clients

    A common pattern in Django projects is to instantiate an API client as a module-level variable based on settings, which has drawbacks, especially during tests and with expensive clients. An alternative pattern involves using functools.cache to instantiate the client on first use and resetting the cache when settings change using Django's setting_changed signal. This approach improves efficiency and testability.

  8. 8
    Article
    Avatar of appsignalAppSignal·2y

    Integrating Stripe Into A One-Product Django Python Shop

    This guide covers integrating Stripe for secure payment handling in a one-product Django online shop. It explains setting up Stripe, creating checkout sessions, handling webhooks for payment events, saving order information, and notifying users through emails. Additionally, it provides tips for optimizing the store and creating an extendable e-commerce site.