DEV Community

loading...
Django News

Issue 38 - New release of Black, Wagtail 2.10.1, articles, and adding flame graphs to django-debug-toolbar.

jefftriplett profile image Jeff Triplett (he/him) Originally published at django-news.com on ・3 min read

News

Announcement of Technical Board Election Registration

There is an upcoming Django Technical Board election. All current DSF Members are automatically registered for this election. If you are not a DSF Member but would like to vote in this election there is a form to fill out.


Black 20.8b1

Pre-release of the latest version of Black, the opinionated Python formatter.


Wagtail 2.10.1 release notes

Bugfix release for the lastest major Wagtail version.


GitHub Changelog: Set the default branch for newly-created repositories

GitHub now allows you to change your default branch name for newly-created repositories.

PSA: On October 1, 2020, GitHub is changing the default from master to main.


Events

PyCon AU / DjangoCon AU 2020 - Sept. 4th – 6th, 2020

PyConline AU and DjangoCon AU are one week away!

pycon.org.au

Articles

Administer All the Things

The next in a series by Matt Layman, this in-depth tutorial focuses on the Django admin.


Python Tools for Managing Virtual Environments

A comprehensive look at the multiple ways to manage Python virtual environments.


Test Elasticsearch in Django Without Mocking

Use Django and pytest to test Elasticsearch without mocking.


Tutorials

Deploying a Production-ready Django app on AWS

A comprehensive guide to deploying a Django app from start to finish using AWS and EC2.


Sponsored Link

Learn beginner to advanced Django

Learn beginner to advanced Django from Daniel "pydanny" Feldroy, co-author of Two Scoops of Django in live, online, interactive classes where students are encouraged to ask questions. Use discount code "django-news" to get 10% off all courses.


Videos

Tech Tips: How to get the best from your remote presentation

Some tech tips on how to get the best from your remote presentation - practical examples about microphones, webcams, lighting, resolutions, and how to get the most from what you already have.


Database Performance Tips with Django

From JetBrains, how to squeeze out performance from your Django-powered database.


Podcasts

Running in Production - Skillwell

Skillwell is video platform with Django that helps you get stronger and be more flexible. It’s hosted on a single $5 / month DigitalOcean server and has been up and running since fall 2019.


Projects

GitHub logo celery / django-celery-beat

Celery Periodic Tasks backed by the Django ORM

Database-backed Periodic Tasks

Build status coverage BSD License django-celery-beat can be installed via wheel Supported Python versions. Support Python implementations.

Version: 2.0.0
Web: http://django-celery-beat.readthedocs.io/
Download: http://pypi.python.org/pypi/django-celery-beat
Source: http://github.com/celery/django-celery-beat
Keywords: django, celery, beat, periodic task, cron, scheduling

About

This extension enables you to store the periodic task schedule in the database.

The periodic tasks can be managed from the Django Admin interface, where you can create, edit and delete periodic tasks and how often they should run.

Using the Extension

Usage and installation instructions for this extension are available from the Celery documentation.

Important Warning about Time Zones

Warning

If you change the Django TIME_ZONE setting your periodic task schedule will still be based on the old timezone.

To fix that you would have to reset the "last run time" for each periodic task:

>>> from django_celery_beat.models import PeriodicTask, PeriodicTasks
>>> PeriodicTask.objects.all().update(last_run_at=None)
>>> for task in PeriodicTask.objects.all():
>>>     PeriodicTasks.changed(task)

Note that this will reset the state as if the periodic tasks have never run before.

Models

  • django_celery_beat.models.PeriodicTask

…


GitHub logo jpadilla / pyjwt

JSON Web Token implementation in Python

PyJWT

https://readthedocs.org/projects/pyjwt/badge/?version=stable

A Python implementation of RFC 7519. Original implementation was written by @progrium.

Sponsor

auth0-logo If you want to quickly add secure token-based authentication to Python projects, feel free to check Auth0's Python SDK and free plan at auth0.com/overview.

Installing

Install with pip:

$ pip install PyJWT

Usage

>>> import jwt
>>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
>>> print(encoded)
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg

>>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
{'some': 'payload'}

Command line

Usage:

pyjwt [options] INPUT

Decoding examples:

pyjwt --key=secret decode TOKEN
pyjwt decode --no-verify TOKEN

See more options executing pyjwt --help.

Documentation

View the full docs online at https://pyjwt.readthedocs.io/en/stable/

Tests

You can run tests from the project root after cloning with:

$ tox

GitHub logo 23andMe / djdt-flamegraph

Flamegraphs for Django Debug Toolbar

DjDT Flame Graph

https://raw.githubusercontent.com/23andMe/djdt-flamegraph/master/fireman.png

Get a flame graph of the current request, right in Django.

https://travis-ci.org/23andMe/djdt-flamegraph.svg?branch=master

Screenshot

https://raw.githubusercontent.com/23andMe/djdt-flamegraph/master/flamegraph-screenshot.png

Features

Install

  • Add djdt_flamegraph to your requirements.txt.
  • Add djdt_flamegraph.FlamegraphPanel to DEBUG_TOOLBAR_PANELS.
  • Run your server with python manage.py runserver --nothreading --noreload

Notes

  • ValueError at /: signal only works in main thread: Flame graphs can only be generated in a single threaded server.
  • Flame graphs are disabled by default. You'll have to enable it by clicking the checkbox next to it in the Debug Toolbar.
  • Probably won't work on Windows.

Development

This panel comes with an example Django app to test with. Just run make example and the server should start running.





GitHub logo jorenvanhee / tailwindcss-debug-screens

A Tailwind CSS component that shows the currently active screen (responsive breakpoint).

Tailwind CSS Debug Screens πŸ“±

A Tailwind CSS component that shows the currently active screen (responsive breakpoint).

Demo

Install

Requires Tailwind v1.0 or higher.

  1. Install the plugin:
npm install tailwindcss-debug-screens --save-dev
  1. Add it to your tailwind.config.js file:
// tailwind.config.js
module.exports = {
  //...
  plugins: [
    require('tailwindcss-debug-screens'),
  ]
}

Usage

Add the class debug-screens to your <body> tag.

<body class="debug-screens">

Make sure the class is only present during development. Here's an example of how you could do that in Craft CMS:

<body class="{{ devMode ? 'debug-screens' : '' }}">

Customization

You can customize this plugin in the theme.debugScreens section of your tailwind.config.js file.

Ignore screens

To ignore a specific screen (for instance if you use dark mode), add the screen name to the ignore configuration array.

// tailwind.config.js
module
…

I have been using this Tailwind CSS component a lot lately. This component show which breakpoint you are using.


Shameless Plugs

LearnDjango.com

All three books in the series--Django for Beginners, Django for APIs, and Django for Professionals--have been updated to Django 3.1.

learndjango.com

Discussion (0)

pic
Editor guide