mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
adding asgi.py
This commit is contained in:
parent
5faa21b72d
commit
b448621387
37
awx/asgi.py
Normal file
37
awx/asgi.py
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2015 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
import os
|
||||
import logging
|
||||
from awx import __version__ as tower_version
|
||||
|
||||
# Prepare the AWX environment.
|
||||
from awx import prepare_env, MODE
|
||||
prepare_env()
|
||||
|
||||
from django.core.wsgi import get_wsgi_application # NOQA
|
||||
|
||||
"""
|
||||
ASGI config for AWX project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``channel_layer``.
|
||||
|
||||
For more information on this file, see
|
||||
https://channels.readthedocs.io/en/latest/deploying.html
|
||||
"""
|
||||
|
||||
if MODE == 'production':
|
||||
logger = logging.getLogger('awx.main.models.jobs')
|
||||
try:
|
||||
fd = open("/var/lib/awx/.tower_version", "r")
|
||||
if fd.read().strip() != tower_version:
|
||||
raise Exception()
|
||||
except Exception:
|
||||
logger.error("Missing or incorrect metadata for Tower version. Ensure Tower was installed using the setup playbook.")
|
||||
raise Exception("Missing or incorrect metadata for Tower version. Ensure Tower was installed using the setup playbook.")
|
||||
|
||||
from channels.asgi import get_channel_layer
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "awx.settings")
|
||||
|
||||
|
||||
channel_layer = get_channel_layer()
|
||||
Loading…
x
Reference in New Issue
Block a user