I need my code run at Django application startup, before Django starts listening for incoming connections. Running my code upon the first HTTP request is not good enough. When I use Gunicorn, my code must run in the parent process, before it forks.
https://mcmap.net/q/49966/-where-to-put-django-startup-code doesn't seem to work in Django 1.4.2: it doesn't run the Middleware's __init__
method until the first request is received. Ditto for adding code to urls.py
.
A quick Google search didn't reveal anything useful.