Skip to content

Instantly share code, notes, and snippets.

View prestontimmons's full-sized avatar

Preston Timmons prestontimmons

View GitHub Profile
@prestontimmons
prestontimmons / README.md
Last active December 13, 2016 15:46
Gunicorn init script

Includes a reload and update command.

Reload sends a SIGHUP to the gunicorn process. This does a graceful reload if the preload option isn't set.

Update sends a SIGUSR2 which starts a new master process. It then sends a QUIT to the old process, which gracefully shuts it down after all connections are closed. This works with the preload option.

I got the idea from Benoit's comment, here:

benoitc/gunicorn#402 (comment)

import json
request = RequestFactory().post(
"/url/",
content_type="application/json",
data=json.dumps([1,2,3]),
)
# or
@prestontimmons
prestontimmons / proposal.md
Last active August 29, 2015 14:22
Template-based widget rendering proposal

Template-based widget rendering

Goal

Enable form widgets to be rendered with user customizable template engines.

Requirements

  • Rendering should be customizable. User's should be able to use Jinja2, DTL or any custom loader they wish. It should be easily configurable.