Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Correct place to put extra startup code in django?

Tags:

python

django

I would like to run some environment checks when my django process starts and die noisily in the case of an error. I'm thinking things like the database has an incorrect encoding or the machine has a python version we don't support.

I'd rather our team be faced with a fatal error that they have to fix, rather than be able to ignore it.

I'm Ok with writing these checks but I'm curious about where the best place to put them is. How do I get them to execute as part of django's startup process? I thought there might be a signal I could listen too, but I can't find a relevant one in the docs.

like image 462
James Healy Avatar asked Nov 25 '09 13:11

James Healy


1 Answers

If you don't want to use settings module, then try project's __init__.py.

like image 112
Cat Plus Plus Avatar answered Sep 19 '22 02:09

Cat Plus Plus