How can I detect if Python is running in Python Development Mode?

Solution 1:

sys.flags.dev_mode is True, when running as python -X dev app.py