Hide DeprecationWarning messages when in production (DEBUG=False).

This commit is contained in:
Chris Church
2013-07-15 13:29:06 -04:00
parent 54f6426c0c
commit 9c39f13056
2 changed files with 13 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
import os
import sys
import warnings
from awx import MODE
from distutils.sysconfig import get_python_lib
@@ -23,6 +24,12 @@ local_site_packages = os.path.join(os.path.dirname(__file__), 'lib',
'site-packages')
sys.path.insert(0, local_site_packages)
# Hide DeprecationWarnings when running in production. Need to first load
# settings to apply our filter after Django's own warnings filter.
from django.conf import settings
if not settings.DEBUG:
warnings.simplefilter('ignore', DeprecationWarning)
# Return the default Django WSGI application.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()