mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Hide DeprecationWarning messages when in production (DEBUG=False).
This commit is contained in:
@@ -5,6 +5,7 @@ __version__ = '1.2.2-0'
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
|
|
||||||
__all__ = ['__version__']
|
__all__ = ['__version__']
|
||||||
|
|
||||||
@@ -39,6 +40,11 @@ def manage():
|
|||||||
local_site_packages = os.path.join(os.path.dirname(__file__), 'lib',
|
local_site_packages = os.path.join(os.path.dirname(__file__), 'lib',
|
||||||
'site-packages')
|
'site-packages')
|
||||||
sys.path.insert(0, local_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)
|
||||||
# Monkeypatch Django find_commands to also work with .pyc files.
|
# Monkeypatch Django find_commands to also work with .pyc files.
|
||||||
import django.core.management
|
import django.core.management
|
||||||
django.core.management.find_commands = find_commands
|
django.core.management.find_commands = find_commands
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
from awx import MODE
|
from awx import MODE
|
||||||
from distutils.sysconfig import get_python_lib
|
from distutils.sysconfig import get_python_lib
|
||||||
|
|
||||||
@@ -23,6 +24,12 @@ local_site_packages = os.path.join(os.path.dirname(__file__), 'lib',
|
|||||||
'site-packages')
|
'site-packages')
|
||||||
sys.path.insert(0, local_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.
|
# Return the default Django WSGI application.
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|||||||
Reference in New Issue
Block a user