You can set the PYTHONOPTIMIZE
environment variable if you really understand what you are doing.
# e.g.
# same as -O
export PYTHONOPTIMIZE=1
# same as -OO
export PYTHONOPTIMIZE=2
Reference: Python doc: Command line and environment
PYTHONOPTIMIZE
If this is set to a non-empty string it is equivalent
to specifying the -O option. If set to an integer, it is equivalent to
specifying -O multiple times.
But normally you should never do it !!!
Deestan's answer for another SO question "Best practice for Python Assert" is really great:
Asserts should be used to test conditions that should never happen.
The purpose is to crash early in the case of a corrupt program state.
Usually a django application uses many other libraries. When something critical happens, and those libraries believe that the application should crash immediately, they follow the best practice above and use asserts. You don't want to break that.