From 8d09d95fc3217981aee9536c3d435e1455e8ae77 Mon Sep 17 00:00:00 2001 From: sadnub Date: Sat, 9 Apr 2022 12:19:38 -0400 Subject: [PATCH] fix ci attempt 2 --- api/tacticalrmm/requirements.txt | 1 + api/tacticalrmm/tacticalrmm/settings.py | 79 +++++++++++-------------- 2 files changed, 35 insertions(+), 45 deletions(-) diff --git a/api/tacticalrmm/requirements.txt b/api/tacticalrmm/requirements.txt index 980e145b..aca78456 100644 --- a/api/tacticalrmm/requirements.txt +++ b/api/tacticalrmm/requirements.txt @@ -23,6 +23,7 @@ pyparsing==3.0.7 pytz==2022.1 qrcode==7.3.1 redis==4.2.2 +hiredis==2.0.0 requests==2.27.1 six==1.16.0 sqlparse==0.4.2 diff --git a/api/tacticalrmm/tacticalrmm/settings.py b/api/tacticalrmm/tacticalrmm/settings.py index 23c024ff..839e8322 100644 --- a/api/tacticalrmm/tacticalrmm/settings.py +++ b/api/tacticalrmm/tacticalrmm/settings.py @@ -46,12 +46,28 @@ DEFAULT_AUTO_FIELD = "django.db.models.AutoField" ASGI_APPLICATION = "tacticalrmm.asgi.application" +LANGUAGE_CODE = "en-us" +TIME_ZONE = "UTC" +USE_I18N = True +USE_L10N = True +USE_TZ = True + +STATIC_URL = "/static/" + +STATIC_ROOT = os.path.join(BASE_DIR, "static") +STATICFILES_DIRS = [os.path.join(BASE_DIR, "tacticalrmm/static/")] + REST_KNOX = { "TOKEN_TTL": timedelta(hours=5), "AUTO_REFRESH": True, "MIN_REFRESH_INTERVAL": 600, } +DEMO = False +DEBUG = False +ADMIN_ENABLED = False +REDIS_HOST = "127.0.0.1" + try: from .local_settings import * except ImportError: @@ -75,7 +91,7 @@ SPECTACULAR_SETTINGS = { } -if not DEBUG: # type: ignore +if not DEBUG: REST_FRAMEWORK.update( {"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",)} ) @@ -93,15 +109,9 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", ] +if DEMO: + MIDDLEWARE += ("tacticalrmm.middleware.DemoMiddleware",) -if ADMIN_ENABLED: # type: ignore - MIDDLEWARE += ("django.contrib.messages.middleware.MessageMiddleware",) - -try: - if DEMO: # type: ignore - MIDDLEWARE += ("tacticalrmm.middleware.DemoMiddleware",) -except: - pass INSTALLED_APPS = [ "django.contrib.auth", @@ -134,7 +144,7 @@ CHANNEL_LAYERS = { "default": { "BACKEND": "channels_redis.core.RedisChannelLayer", "CONFIG": { - "hosts": [(REDIS_HOST, 6379)], # type: ignore + "hosts": [(REDIS_HOST, 6379)], }, }, } @@ -142,24 +152,15 @@ CHANNEL_LAYERS = { CACHES = { "default": { "BACKEND": "django.core.cache.backends.redis.RedisCache", - "LOCATION": f"redis://{REDIS_HOST}:6379", # type: ignore + "LOCATION": f"redis://{REDIS_HOST}:6379", "OPTIONS": { "parser_class": "redis.connection.HiredisParser", "pool_class": "redis.BlockingConnectionPool", + "db": "10", }, } } -if "AZPIPELINE" in os.environ: - ADMIN_ENABLED = False - -if ADMIN_ENABLED: # type: ignore - INSTALLED_APPS += ( - "django.contrib.admin", - "django.contrib.messages", - ) - - MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", @@ -173,7 +174,7 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", ] -if DEBUG: # type: ignore +if DEBUG: INSTALLED_APPS += ( "django_extensions", "silk", @@ -181,14 +182,16 @@ if DEBUG: # type: ignore MIDDLEWARE.insert(0, "silk.middleware.SilkyMiddleware") -if ADMIN_ENABLED: # type: ignore +if ADMIN_ENABLED: MIDDLEWARE += ("django.contrib.messages.middleware.MessageMiddleware",) + INSTALLED_APPS += ( + "django.contrib.admin", + "django.contrib.messages", + ) + +if DEMO: + MIDDLEWARE += ("tacticalrmm.middleware.DemoMiddleware",) -try: - if DEMO: # type: ignore - MIDDLEWARE += ("tacticalrmm.middleware.DemoMiddleware",) -except: - pass ROOT_URLCONF = "tacticalrmm.urls" @@ -226,23 +229,6 @@ AUTH_PASSWORD_VALIDATORS = [ }, ] - -LANGUAGE_CODE = "en-us" - -TIME_ZONE = "UTC" - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - - -STATIC_URL = "/static/" - -STATIC_ROOT = os.path.join(BASE_DIR, "static") -STATICFILES_DIRS = [os.path.join(BASE_DIR, "tacticalrmm/static/")] - LOGGING = { "version": 1, "disable_existing_loggers": False, @@ -265,6 +251,9 @@ LOGGING = { }, } +if "AZPIPELINE" in os.environ: + ADMIN_ENABLED = False + if "GHACTIONS" in os.environ: print("-----------------------PIPELINE----------------------------") DATABASES = {