import os import sys from zoneinfo import ZoneInfo from django.utils import timezone sys.path.insert(1, os.path.dirname(os.path.realpath(__file__))) # Project root directory PROJECT_ROOT = os.path.abspath(__file__ + "/../../../") # DEBUG mode DEBUG = (os.environ["AIRCOX_DEBUG"].lower() in ("true", 1)) if "AIRCOX_DEBUG" in os.environ else False # Internationalization and timezones: thoses values may be set in order to # have correct translation and timezone. # Current language code. e.g. 'fr_BE' LANGUAGE_CODE = "en-US" # Locale LC_LOCALE = "en_US.UTF-8" # Current timezone. e.g. 'Europe/Brussels' TIME_ZONE = os.environ.get("TZ") or "UTC" # Secret key: you MUST put a consistent secret key. You can generate one # at https://djecrety.ir/ SECRET_KEY = "" # Database configuration DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": os.path.join(PROJECT_ROOT, "db.sqlite3"), "TIMEZONE": TIME_ZONE, } } DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" # Allowed host for HTTP requests ALLOWED_HOSTS = ("127.0.0.1",) # Assets and medias: # In production, user MUST configure webserver in order to serve static # and media files. # Website's path to statics assets STATIC_URL = "/static/" # Website's path to medias (uploaded images, etc.) MEDIA_URL = "/media/" # Website URL path to medias (uploaded images, etc.) SITE_MEDIA_URL = "/media/" # Path to assets' directory (by default in project's directory) STATIC_ROOT = os.path.join(PROJECT_ROOT, "static") # Path to media directory (by default in static's directory) MEDIA_ROOT = os.path.join(STATIC_ROOT, "media") # Enables internationalization and timezone USE_I18N = True USE_L10N = True USE_TZ = True timezone.activate(ZoneInfo(TIME_ZONE)) try: import locale locale.setlocale(locale.LC_ALL, LC_LOCALE) except Exception: print( "Can not set locale {LC}. Is it available on you system? Hint: " "Check /etc/locale.gen and rerun locale-gen as sudo if needed.".format(LC=LANGUAGE_CODE) ) pass # -- django-taggit TAGGIT_CASE_INSENSITIVE = True # -- easy_thumbnails THUMBNAIL_PROCESSORS = ( "easy_thumbnails.processors.colorspace", "easy_thumbnails.processors.autocrop", #'easy_thumbnails.processors.scale_and_crop', "filer.thumbnail_processors.scale_and_crop_with_subject_location", "easy_thumbnails.processors.filters", ) # Enabled applications INSTALLED_APPS = ( "radiocampus", "aircox_streamer.apps.AircoxStreamerConfig", "aircox.apps.AircoxConfig", # Aircox dependencies "rest_framework", "django_filters", "content_editor", "easy_thumbnails", "filer", "taggit", "adminsortable2", "honeypot", # Django "django.contrib.contenttypes", "django.contrib.auth", "django.contrib.humanize", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.admin", ) MIDDLEWARE = ( "django.middleware.gzip.GZipMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.locale.LocaleMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.security.SecurityMiddleware", "aircox.middleware.AircoxMiddleware", ) ROOT_URLCONF = "instance.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": (os.path.join(PROJECT_ROOT, "templates"),), # 'APP_DIRS': True, "OPTIONS": { "context_processors": ( "django.contrib.auth.context_processors.auth", "django.template.context_processors.debug", "django.template.context_processors.i18n", "django.template.context_processors.media", "django.template.context_processors.request", "django.template.context_processors.static", "django.template.context_processors.tz", "django.contrib.messages.context_processors.messages", "aircox.context_processors.station", ), "loaders": ( "django.template.loaders.filesystem.Loader", "django.template.loaders.app_directories.Loader", ), }, }, ] WSGI_APPLICATION = "instance.wsgi.application" LOGOUT_REDIRECT_URL = "/" REST_FRAMEWORK = { "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", "PAGE_SIZE": 50, "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"], }