Fix official image builds

I broke everything in https://github.com/ansible/awx/pull/11242.

These changes were necessary in order to run `awx-manage collectstatic` without a running database.
This commit is contained in:
Shane McDonald
2021-10-25 17:45:59 -04:00
parent 0ae67edaba
commit f6e63d0917
4 changed files with 16 additions and 3 deletions

View File

@@ -151,7 +151,7 @@ def manage():
from django.core.management import execute_from_command_line
# enforce the postgres version is equal to 12. if not, then terminate program with exit code of 1
if not MODE == 'development':
if not os.getenv('SKIP_PG_VERSION_CHECK', False) and not MODE == 'development':
if (connection.pg_version // 10000) < 12:
sys.stderr.write("Postgres version 12 is required\n")
sys.exit(1)

View File

@@ -9,6 +9,7 @@ import copy
import errno
import sys
import traceback
import socket
# Django Split Settings
from split_settings.tools import optional, include
@@ -88,4 +89,8 @@ except IOError:
# The below runs AFTER all of the custom settings are imported.
DATABASES['default'].setdefault('OPTIONS', dict()).setdefault('application_name', f'{CLUSTER_HOST_ID}-{os.getpid()}-{" ".join(sys.argv)}'[:63]) # noqa
CLUSTER_HOST_ID = socket.gethostname()
DATABASES.setdefault('default', dict()).setdefault('OPTIONS', dict()).setdefault(
'application_name', f'{CLUSTER_HOST_ID}-{os.getpid()}-{" ".join(sys.argv)}'[:63]
) # noqa