Собрали в одном месте самые важные ссылки
читайте нас в Twitter
I have just released the second update to Boost Your Django DX, my book of developer experience (DX) recommendations for Django projects. This update contains a new chapter, changes some recommended tools, and upgrades to Python 3.13 and Django 5.1. Overall, the book is 45 pages longer, now totalling 326! The most significant new addition is a chapter on debuggers: Python’s built-in one, pdb, and IPython’s enhanced version, ipdb. The chapter introduces pdb with realistic examples, covers all the essential commands, and includes many tips, like using the .pdbrc configuration file. Another major change is swapping the recommended CSS and JavaScript tools from ESLint and Prettier to Biome. Biome is a super-fast formatter and linter for CSS, JavaScript, JSON, TypeScript, and more. The new section introduces it and provides integration advice for Django projects. Thank you to everyone who has supported the book so far. Just the other day, it reached fifty five-star reviews. I am very grateful for all the feedback from the community and aim to keep improving the book. This update is free for all who previously purchased the book. To help readers catch up, the introduction chapter has a changelog with links to the updated sections, reproduced below. Boost Your Django DX and all my other books are currently discounted 50% for Black Friday. This stacks with the automatic discount to match local purchasing power in your country and the DX bundle deal. Buy now on Gumroad May your workflow be ever more efficient and your code bug free, —Adam Changelog Restructured the book: The first and last chapters are now called “Introduction” and “Outroduction”, for consistency with my other books. The documentation chapter has moved from the start of the book to the middle, to make the start more exciting. The code quality tools chapters have been reorganized, spreading the content from two chapters to three, with a new chapter titled “Python code quality tools”. Upgraded to Python 3.13 and Django 5.1. Added a chapter on debuggers, covering ways to use pdb and ipdb within your Django project. Previously, the IPython section had a short mention of ipdb, with the sentence: pdb is fantastic and worth learning, but that’s for another book or blog post… Well, that’s not in another book or blog post, it’s here now. Enjoy and happy debugging. Added a section on Djade, my new tool for formatting Django templates. Added a section on Biome, a formatter and linter for CSS, JavaScript, JSON, TypeScript, and more. This tool replaces my recommendations for ESLint and Prettier, which have been removed per the below release notes. Added a section on IPython’s %who and %whos magic commands. Updated the isort section to cover the force_single_line option. Updated the Flake8 section to demonstrate some rules and recommend disabling E501, the maximum line length rule. I don’t think it’s worth the effort to fix or individually ignore most “line too long” errors. Added Django TV and django-classy-doc to Bonus Django documentation sites. Edited the Black section to cover setting the target version with project.requires-python, rather than tool.black.target-version. Removed the section on reorder-python-imports. Unfortunately, it is incompatible with Black version 24, with no fix planned. I recommend using isort instead, which is Black-compatible and can apply a similar style with the force_single_line option. Removed the (rather small) section on Mypy. It didn’t really provide much value. Removed the section on DjHTML. Whilst still a nice tool, its indentation modification can break some whitespace-sensitive contexts, such as <pre> tags. Also it removes formatting indentation from inline JavaScript, often used with frameworks like Alpine.js. Removed the section on ESLint. It no longer operates correctly under pre-commit since its version 9 release, and I recommend using Biome instead. Removed the section on Prettier. Its pre-commit hook is no longer maintained, and I recommend using Biome instead. Table of contents Introduction About this book Read in any order Example commands and resources End-of-chapter feedback links Acknowledgements Changelog Virtual environments and dependencies On tools and choice Virtual environments Create a virtual environment with venv Avoid committing your virtual environment Activate a virtual environment Deactivate a virtual environment Maybe use virtualenv instead of venv Pip and extra tools Invoke Pip safely The problems with pip freeze > requirements.txt pip-compile: simple dependency management Convert an existing requirements.txt file to pip-compile Add a new dependency with pip-compile Remove a dependency With pip-compile Upgrade dependencies with pip-compile pip-lock: keep all environments up to date Dependency management Stick to a single set of dependencies (probably) Pick new dependencies carefully Set a dependency upgrade schedule Python’s Development Mode Enable development mode Check if development mode is enabled When to use development mode Python shell The shell command Execute a string with -c Execute a temporary file with -c 'import t' IPython: a superior Python shell Install IPython Get help with ? or ?? Advanced autocomplete with tab Reuse results with the output history Export and rerun code with the input history Copy in code with multi-line paste and %cpaste Iterate quickly with autoreload List all imported names with %who and %whos Start IPython within your code with IPython.embed() Benchmark code with %timeit django-read-only: production data protection Quickly toggle read-only mode in IPython with %read_only Debuggers pdb: Python’s built-in debugger Some initial examples Basic commands Ways to start pdb Extend pdb with .pdbrc Write snapshot-style tests quickly with --pdb ipdb: IPython enhancements to pdb Extra features Install and use ipdb Development server Django Debug Toolbar: a development boon Install and configure Explore the toolbar Find problematic database queries with the SQL panel Trace non-HTML requests with the history panel django-browser-reload: automatically reload your browser in development Reloads triggered by template changes Reloads triggered by static asset changes Reloads triggered by code changes Installation Rich: beautiful terminal output Server logs Management commands Code quality tools EditorConfig: consistent text editing pre-commit: a code quality framework What pre-commit is Install pre-commit Add a configuration file Configuration structure Pin language versions with default_language_version Various ways to run hooks Update hooks With pre-commit autoupdate Run pre-commit in CI with pre-commit ci Introduce a hook incrementally Python code quality tools Black: the uncompromising code formatter How Black formats code Install and configure Black isort: sorted, grouped import statements isort’s style Split from imports one-per-line with force_single_line Install and configure isort Add or remove imports from every file Flake8: an extensible linter Linting examples Install and configure Flake8 flake8-bugbear: extra checks for common problems flake8-no-pep420: avoid package problems Further plugins pyupgrade: upgrade to the latest Python syntax Some example rewrites Install and configure django-upgrade: upgrade to the latest Django features Example rewrites Install and configure Further code quality tools Djade: a template formatter Formatting examples Install and configure Biome: a linter-formatter for CSS, JavaScript, JSON, and more CSS formatting examples CSS linting examples JavaScript formatting examples JavaScript linting examples JSON, TypeScript, and other languages Install and configure ShellCheck: find bugs in your shell scripts An example Install blacken-docs: apply Black to documentation pre-commit-hooks: general purpose checks Build your own tools pre-commit’s virtual languages: rapid checks Block files based on name with a custom “fail” hook Block files based on content with a regular expression hook Flake8 plugin: custom source code checks The Abstract Syntax Tree (AST) Further AST exploration Plugin structure Make a plugin to ban lambda Test your plugin Further reading Write a custom tool Replace Django documentation links What pre-commit expects of tools Make a tool Example usage Run the tool with pre-commit Add tests Documentation DevDocs: the free rapid documentation tool Get started and set up Django’s docs Perform a basic search Search a single documentation source Reset the search box Visit the original documentation site Download documentation sources for offline use Useful documentation sources More on DevDocs DuckDuckGo: a developer-friendly search engine Access DuckDuckGo Keyboard shortcuts Bangs: shortcuts to other search pages Instant Answers: expanded results on the first page Bonus Django documentation sites Classy Class-Based Views Classy Django Forms Template Tags and Filters Classy Django REST Framework Awesome Django Django TV A bonus bonus: django-classy-doc Wget: download any website Install How to download a website Example: the Django REST Framework documentation Read offline documentation with Python’s web server An explanation of all the flags Miscellaneous tips and tricks Python documentation Django documentation Read the Docs Sphinx Settings Structure your settings Use a single settings file with environment variables Load a .env file locally Settings in tests Group and sort settings Order INSTALLED_APPS Use pathlib for BASE_DIR A settings file template Some settings patterns to avoid Don’t read settings at import time Avoid direct setting changes Don’t import your project settings module Avoid creating custom settings where module constants would do Avoid creating dynamic module constants instead of settings Name your custom settings well Override complex settings correctly Test your settings file Test your settings functions Test your settings logic Models and migrations Seed your database with a custom management command Sample data approaches Create a command Test your command Factory Boy: easier data generation Install and define factories Invoke factories Use factories in tests Use factories in seed_database Further features Migration safeguards Test for pending migrations django-linear-migrations: prevent merge migrations System checks How system checks work The basics How to silence checks The advantages of checks Write your own checks How to write a check function How to register a check function Add a check for Python’s development mode Add a check for model class names Test your checks Test the development mode check Test the model name check Further places that checks live Model class checks Model field checks django-version-checks: keep your environments in sync Install and configure Upgrading dependencies Outroduction Further reading Thank you
Here are some Django-related deals for this year’s Black Friday (29th November) and Cyber Monday (1st December), including my own. I’ll keep this post up to date with any new deals I learn about. If you are also a creator, email me with details of your offer and I’ll add it here. `__. --> For more general developer-related deals, see BlackFridayDeals.dev. My books My three books have a 50% discount, for both individual and team licenses, until the end of Cyber Monday (1st December). This deal stacks with the purchasing power parity discount for those in lower-income countries. Buy now: Boost Your Django DX - $21 instead of $42 (freshly updated!) Boost Your Git DX - $19.50 instead of $39 Speed Up Your Django Tests - $24.50 instead of $49 Aidas Bendoraitis’ paid packages Aidas Bendoraitis of djangotricks.com has created two paid packages. Use the links below for a 20% discount, available until the end of the 1st December. Django GDPR Cookie Consent - a customizable, self-hosted cookie consent screen. This package takes the pain out of setting up legally-mandated cookie banners and settings, without using an expensive or inflexible vendor. Buy it on Gumroad Django Paddle Subscriptions - an integration with Paddle’s billing API for subscriptions. This package allows you to collect SaaS payments internationally with a reliable payment processor. Buy it on Gumroad Appliku Appliku is a deployment tool designed for Django. It can deploy your project to AWS, DigitalOcean, Hetzner, and other cloud servers. They’re offering 30% off all annual plans, until the 3rd December. Use code BLACKFRIDAY2024 at checkout. Buy on the Appliku site Async Patterns in Django Freshly released in June, this book is a tour through the advanced topic of asynchronous programming in Django. It covers the range of tools and protocols available for asynchronous behaviour in your web application. It’s written by Paul Bailey, an experienced Principle Engineer. Paul is offering 50% off the book with the coupon link, discounting the book to $23. This is available until the 3rd December. Buy on Leanpub Django in Action Another book published in June this year, this one covers building a project from scratch, detailing how the key pieces of Django fit together. It also extends the project a bit with htmx, a tool that I really like. It’s written by Christopher Trudeau, the co-host of the Real Python podcast and a prolific writer. The publisher, Manning, is offering 50% off the book, from 25th November to 3rd December. Use code mltrudeaublog at checkout. Buy on Manning SaaS Pegasus Cory Zue’s SaaS Pegasus is a configurable Django project template with many preset niceties, including teams, Stripe subscriptions, a JavaScript pipeline, and multiple CSS themes. It can massively accelerate setting up a SaaS in Django. The “unlimited lifetime license” is discounted 50%, from $999 to $499.50. This deal is available from the 22nd November until the 4th December. Buy it on saaspegasus.com testdriven.io course bundle The educational site testdriven.io is running a sale on a bundle of five Django courses: Test-Driven Development with Django, Django REST Framework, and Docker by Michael Herman The Definitive Guide to Celery and Django by Michael Yin Full-text Search in Django with Postgres and Elasticsearch by Jason Parent Developing RESTful APIs with Django REST Framework by Špela Giacomelli Full-stack Django with HTMX and Tailwind by Špela Giacomelli Normally these four courses would total $160, but the bundle has a 30% discount to $112. This discount is available until the 2nd December. Buy it on testdriven.io Bonus: Django itself This one isn’t really a “deal”, but I would like to take a moment to encourage you to contribute to Django itself. If you buy any of the above products, please consider supporting the Django Software Foundation, the charity that runs Django, in its work promoting the community and the framework. Your money will go towards: Paying the Django Fellows, Natalia and Sarah, who merge respond to tickets, merge code, and make releases. Helping organize DjangoCons in Africa, America, and Europe, and other events. Hosting costs of the documentation, source code, ticketing system, and CI system. A very long tail of activities that keep the framework alive and thriving. Donate to Django on: GitHub Sponsors - adds to your GitHub bill. Threadless - grab some custom-printed merchandise. The Fundraising Page - bills from a credit card with Stripe. At the time of writing, Django is only 82% towards its annual funding goal of $200,000: Let’s fill up that heart! 💚💚💚 Fin May you have fun supporting Django creators and the DSF this Black Friday and Cyber Monday! —Adam
http клиент/сервер для asyncio. Скачать можно по ссылке: https://pypi.python.org/pypi/aiohttp
Django module to easily send templated emails using django templates, or using a transactional mail provider (mailchimp, silverpop, etc.).
A dive into NanoDjango, a package that lets you build small scripts using all the power of Django, and also supports django-ninja for APIs.
Гибкий фреймворк для написания web-пауков (парсеров). Скачать можно по ссылке: https://pypi.python.org/pypi/scrapy
PyPA’s Trusted Publishers let you upload Python packages directly from your CI pipeline to PyPI.
http клиент/сервер для asyncio. Скачать можно по ссылке: https://pypi.python.org/pypi/aiohttp
Web-фреймворк на основе Werkzeug, Jinja2 и благих намерениях. Скачать можно по ссылке: https://pypi.python.org/pypi/Flask/