""" Django settings for Tierra2Pruebas project. Generated by 'django-admin startproject' using Django 2.1.5. For more information on this file, see https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.1/ref/settings/ """ import os from tools.log import Log # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'jiuh5fc0qwk^b02cemys)1mq%16#z3!*-am^y52z$a=*g+)twy' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', # LIM # 'monitorT', 'bootstrap4' ] # Sorted to force load MG.itasker at last place sorted_apps = [app for app in list(os.walk("./"))[0][1] if app in ["GMS", "AI", "Tierra_2"]] sorted_apps.append("MG") for app in sorted_apps: sorted_subapps = list(os.walk("./" + app))[0][1] if app == "MG": sorted_subapps = [subapp for subapp in list(os.walk("./" + app))[0][1] if subapp not in ["itasker"]] sorted_subapps.append("itasker") for subapp in sorted_subapps: is_tierra2_app = (('Tierra_2' in app) and (('alm' in subapp) or ('pro' in subapp) or ('cap' in subapp) or ('qc' in subapp)or ('dis' in subapp) or ('solutions' in subapp))) is_GMS_app = (('GMS' in app) and ('tools' not in subapp) and ('__pycache__' not in subapp)) is_MG_app = (('MG' in app) and ('tools' not in subapp) and ('__pycache__' not in subapp)) is_AI_app = (('AI' in app) and ('tools' not in subapp) and ('__pycache__' not in subapp)) if not is_tierra2_app and not is_GMS_app and not is_MG_app and not is_AI_app: continue INSTALLED_APPS.append(app + '.' + subapp) # Add autodoc app INSTALLED_APPS.append('docs') # Install MonitorT INSTALLED_APPS.append('monitorT') CORS_ORIGIN_ALLOW_ALL = True # LIM MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', # LIM 'django.middleware.common.CommonMiddleware', # AAV 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware' ] ROOT_URLCONF = 'Django_server.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'Tierra_2', 'templates'), ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'Django_server.wsgi.application' # Database # https://docs.djangoproject.com/en/2.1/ref/settings/#databases # DATABASES = { # 'default': { # 'ENGINE': 'django.db.backends.postgresql_psycopg2', # 'NAME': 'DJANGO', # 'USER': 'postgres', # 'PASSWORD': 'pg', # 'HOST': '192.168.1.52', # 'PORT': '5433', # } # } DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'postgres', 'USER': 'postgres', 'PASSWORD': 'pg', 'HOST': 'postgresql_meta', 'PORT': '5432', } } # Password validation # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = 'static_root/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), os.path.join(BASE_DIR, 'Tierra_2', 'static'), ) # Redirect to home URL after login (Default redirects to /accounts/profile/) LOGIN_REDIRECT_URL = '/Tierra_2/solutions/indexTierra2/' FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440*250 DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440*250 # Path to databases. Will be overwritten by StaticBase object that allow # some operations with the StaticDatabase STATIC_DATABASE = {'sentinel': {'path': '/home/roberto/sentinel'}} X_FRAME_OPTIONS = 'ALLOW-FROM *' # CUSTOM LOG LOG = Log(DEBUG, not DEBUG) if not DEBUG: os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Remove all debugging messages of tensorflow GDRIVE_API_CREDENTIALS_PATH = os.path.join(BASE_DIR, 'credentials.json') DROPBOX_API_CREDENTIALS_PATH = os.path.join(BASE_DIR, 'dropbox_app_credentials.json') CIPHER_KEY = os.path.join(BASE_DIR, 'MG', 'authenticate', 'certs', 'key.key') CERTS_DB_PATH = os.path.join(BASE_DIR, 'MG', 'authenticate', 'certs', 'certs.db')