So I want to physically get rid of debugging code before deploying it to appengine. What I'm doing right now is a simple check:
settings.py:
DEBUG = os.environ['HTTP_HOST'] == 'localhost'
from settings import DEBUG
if DEBUG:
#ensure I haven't screwed smth up during refactoring
But this check will be consuming CPU cycles during each call, right? In Java, there's a pattern that would strip debugging code at compile time:
public static final boolean DEBUG = true; // change to false before going production
if(DEBUG){
//debug logging
}
Is there a clean way to achieve the same effect in Python or should I wrap the code to be stripped with smth like #%STRIP_ME%
and then run a custom script against it?