|
|
""" |
|
|
Django settings for detect_backend project. |
|
|
|
|
|
Generated by 'django-admin startproject' using Django 5.2.10. |
|
|
|
|
|
For more information on this file, see |
|
|
https://docs.djangoproject.com/en/5.2/topics/settings/ |
|
|
|
|
|
For the full list of settings and their values, see |
|
|
https://docs.djangoproject.com/en/5.2/ref/settings/ |
|
|
""" |
|
|
|
|
|
from pathlib import Path |
|
|
|
|
|
import os |
|
|
|
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SECRET_KEY = os.environ.get('SECRET_KEY', 'django-insecure-v08kb%ko-ykavpol*d)o$ld&q47=4whjv@g1#js^(pnm0=yfu_') |
|
|
|
|
|
|
|
|
DEBUG = os.environ.get('DEBUG', 'True') == 'True' |
|
|
|
|
|
ALLOWED_HOSTS = ['*'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSTALLED_APPS = [ |
|
|
'django.contrib.admin', |
|
|
'django.contrib.auth', |
|
|
'django.contrib.contenttypes', |
|
|
'django.contrib.sessions', |
|
|
'django.contrib.messages', |
|
|
'whitenoise.runserver_nostatic', |
|
|
'django.contrib.staticfiles', |
|
|
'rest_framework', |
|
|
'corsheaders', |
|
|
'detector', |
|
|
] |
|
|
|
|
|
MIDDLEWARE = [ |
|
|
'django.middleware.security.SecurityMiddleware', |
|
|
'whitenoise.middleware.WhiteNoiseMiddleware', |
|
|
'corsheaders.middleware.CorsMiddleware', |
|
|
'django.contrib.sessions.middleware.SessionMiddleware', |
|
|
'django.middleware.common.CommonMiddleware', |
|
|
'django.middleware.csrf.CsrfViewMiddleware', |
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
|
'django.contrib.messages.middleware.MessageMiddleware', |
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware', |
|
|
] |
|
|
|
|
|
CORS_ALLOWED_ORIGINS = [ |
|
|
"http://localhost:5173", |
|
|
"http://localhost:5174", |
|
|
"http://localhost:5175", |
|
|
"https://huggingface.co", |
|
|
] |
|
|
|
|
|
|
|
|
CORS_ALLOW_ALL_ORIGINS = True |
|
|
|
|
|
|
|
|
X_FRAME_OPTIONS = 'ALLOWALL' |
|
|
XS_SHARING_ALLOWED_METHODS = ['POST', 'GET', 'OPTIONS', 'PUT', 'DELETE'] |
|
|
|
|
|
|
|
|
CSRF_TRUSTED_ORIGINS = [ |
|
|
'https://huggingface.co', |
|
|
'https://*.hf.space', |
|
|
'https://*.huggingface.co', |
|
|
] |
|
|
|
|
|
ROOT_URLCONF = 'detect_backend.urls' |
|
|
|
|
|
TEMPLATES = [ |
|
|
{ |
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates', |
|
|
'DIRS': [BASE_DIR / 'frontend_build'], |
|
|
'APP_DIRS': True, |
|
|
'OPTIONS': { |
|
|
'context_processors': [ |
|
|
'django.template.context_processors.request', |
|
|
'django.contrib.auth.context_processors.auth', |
|
|
'django.contrib.messages.context_processors.messages', |
|
|
], |
|
|
}, |
|
|
}, |
|
|
] |
|
|
|
|
|
WSGI_APPLICATION = 'detect_backend.wsgi.application' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DATABASES = { |
|
|
'default': { |
|
|
'ENGINE': 'django.db.backends.sqlite3', |
|
|
'NAME': BASE_DIR / 'db.sqlite3', |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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', |
|
|
}, |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LANGUAGE_CODE = 'en-us' |
|
|
|
|
|
TIME_ZONE = 'UTC' |
|
|
|
|
|
USE_I18N = True |
|
|
|
|
|
USE_TZ = True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STATIC_URL = 'static/' |
|
|
STATIC_ROOT = BASE_DIR / 'staticfiles' |
|
|
|
|
|
|
|
|
STATICFILES_DIRS = [ |
|
|
BASE_DIR / 'frontend_build', |
|
|
] |
|
|
|
|
|
|
|
|
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |
|
|
|