|
1 |
| -# Copyright (c) 2015 Ansible, Inc. |
2 |
| -# All Rights Reserved. |
3 |
| - |
4 |
| -# Development settings for AWX project. |
5 |
| - |
6 |
| -# Python |
| 1 | +# This file exists for backwards compatibility only |
| 2 | +# the current way of running AWX is to point settings to |
| 3 | +# awx/settings/__init__.py as the entry point for the settings |
| 4 | +# that is done by exporting: export DJANGO_SETTINGS_MODULE=awx.settings |
7 | 5 | import os
|
8 |
| -import socket |
9 |
| -import copy |
10 |
| -import sys |
11 |
| -import traceback |
12 |
| - |
13 |
| -# Centos-7 doesn't include the svg mime type |
14 |
| -# /usr/lib64/python/mimetypes.py |
15 |
| -import mimetypes |
16 |
| - |
17 |
| -# Django Split Settings |
18 |
| -from split_settings.tools import optional, include |
19 |
| - |
20 |
| -# Load default settings. |
21 |
| -from .defaults import * # NOQA |
22 |
| - |
23 |
| -# awx-manage shell_plus --notebook |
24 |
| -NOTEBOOK_ARGUMENTS = ['--NotebookApp.token=', '--ip', '0.0.0.0', '--port', '9888', '--allow-root', '--no-browser'] |
25 |
| - |
26 |
| -# print SQL queries in shell_plus |
27 |
| -SHELL_PLUS_PRINT_SQL = False |
28 |
| - |
29 |
| -# show colored logs in the dev environment |
30 |
| -# to disable this, set `COLOR_LOGS = False` in awx/settings/local_settings.py |
31 |
| -COLOR_LOGS = True |
32 |
| -LOGGING['handlers']['console']['()'] = 'awx.main.utils.handlers.ColorHandler' # noqa |
33 |
| - |
34 |
| -ALLOWED_HOSTS = ['*'] |
35 |
| - |
36 |
| -mimetypes.add_type("image/svg+xml", ".svg", True) |
37 |
| -mimetypes.add_type("image/svg+xml", ".svgz", True) |
38 |
| - |
39 |
| -# Disallow sending session cookies over insecure connections |
40 |
| -SESSION_COOKIE_SECURE = False |
41 |
| - |
42 |
| -# Disallow sending csrf cookies over insecure connections |
43 |
| -CSRF_COOKIE_SECURE = False |
44 |
| - |
45 |
| -# Disable Pendo on the UI for development/test. |
46 |
| -# Note: This setting may be overridden by database settings. |
47 |
| -PENDO_TRACKING_STATE = "off" |
48 |
| -INSIGHTS_TRACKING_STATE = False |
49 |
| - |
50 |
| -# debug toolbar and swagger assume that requirements/requirements_dev.txt are installed |
51 |
| - |
52 |
| -INSTALLED_APPS += ['drf_yasg', 'debug_toolbar'] # NOQA |
53 |
| - |
54 |
| -MIDDLEWARE = ['debug_toolbar.middleware.DebugToolbarMiddleware'] + MIDDLEWARE # NOQA |
55 |
| - |
56 |
| -DEBUG_TOOLBAR_CONFIG = {'ENABLE_STACKTRACES': True} |
57 |
| - |
58 |
| -# Configure a default UUID for development only. |
59 |
| -SYSTEM_UUID = '00000000-0000-0000-0000-000000000000' |
60 |
| -INSTALL_UUID = '00000000-0000-0000-0000-000000000000' |
61 |
| - |
62 |
| -# Ansible base virtualenv paths and enablement |
63 |
| -# only used for deprecated fields and management commands for them |
64 |
| -BASE_VENV_PATH = os.path.realpath("/var/lib/awx/venv") |
65 |
| - |
66 |
| -CLUSTER_HOST_ID = socket.gethostname() |
67 |
| - |
68 |
| -AWX_CALLBACK_PROFILE = True |
69 |
| - |
70 |
| -# this modifies FLAGS set by defaults |
71 |
| -FLAGS['FEATURE_INDIRECT_NODE_COUNTING_ENABLED'] = [{'condition': 'boolean', 'value': True}] # noqa |
72 |
| - |
73 |
| -# ======================!!!!!!! FOR DEVELOPMENT ONLY !!!!!!!================================= |
74 |
| -# Disable normal scheduled/triggered task managers (DependencyManager, TaskManager, WorkflowManager). |
75 |
| -# Allows user to trigger task managers directly for debugging and profiling purposes. |
76 |
| -# Only works in combination with settings.SETTINGS_MODULE == 'awx.settings.development' |
77 |
| -AWX_DISABLE_TASK_MANAGERS = False |
78 |
| - |
79 |
| -# Needed for launching runserver in debug mode |
80 |
| -# ======================!!!!!!! FOR DEVELOPMENT ONLY !!!!!!!================================= |
81 |
| - |
82 |
| -# Store a snapshot of default settings at this point before loading any |
83 |
| -# customizable config files. |
84 |
| -this_module = sys.modules[__name__] |
85 |
| -local_vars = dir(this_module) |
86 |
| -DEFAULTS_SNAPSHOT = {} # define after we save local_vars so we do not snapshot the snapshot |
87 |
| -for setting in local_vars: |
88 |
| - if setting.isupper(): |
89 |
| - DEFAULTS_SNAPSHOT[setting] = copy.deepcopy(getattr(this_module, setting)) |
90 |
| - |
91 |
| -del local_vars # avoid temporary variables from showing up in dir(settings) |
92 |
| -del this_module |
93 |
| -# |
94 |
| -############################################################################################### |
95 |
| -# |
96 |
| -# Any settings defined after this point will be marked as as a read_only database setting |
97 |
| -# |
98 |
| -################################################################################################ |
99 |
| - |
100 |
| -# If there is an `/etc/tower/settings.py`, include it. |
101 |
| -# If there is a `/etc/tower/conf.d/*.py`, include them. |
102 |
| -include(optional('/etc/tower/settings.py'), scope=locals()) |
103 |
| -include(optional('/etc/tower/conf.d/*.py'), scope=locals()) |
104 |
| - |
105 |
| -# If any local_*.py files are present in awx/settings/, use them to override |
106 |
| -# default settings for development. If not present, we can still run using |
107 |
| -# only the defaults. |
108 |
| -# this needs to stay at the bottom of this file |
109 |
| -try: |
110 |
| - if os.getenv('AWX_KUBE_DEVEL', False): |
111 |
| - include(optional('development_kube.py'), scope=locals()) |
112 |
| - else: |
113 |
| - include(optional('local_*.py'), scope=locals()) |
114 |
| -except ImportError: |
115 |
| - traceback.print_exc() |
116 |
| - sys.exit(1) |
117 |
| - |
118 |
| -# The below runs AFTER all of the custom settings are imported |
119 |
| -# because conf.d files will define DATABASES and this should modify that |
120 |
| -from .application_name import set_application_name |
121 | 6 |
|
122 |
| -set_application_name(DATABASES, CLUSTER_HOST_ID) # NOQA |
| 7 | +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "awx.settings") |
| 8 | +os.environ.setdefault("AWX_MODE", "development") |
123 | 9 |
|
124 |
| -del set_application_name |
| 10 | +from ansible_base.lib.dynamic_config import export |
| 11 | +from . import DYNACONF # noqa |
125 | 12 |
|
126 |
| -# Set the value of any feature flags that are defined in the local settings |
127 |
| -for feature in list(FLAGS.keys()): # noqa: F405 |
128 |
| - if feature in locals(): |
129 |
| - FLAGS[feature][0]['value'] = locals()[feature] # noqa: F405 |
| 13 | +export(__name__, DYNACONF) |
0 commit comments