Spaces:
Running
Running
| from pathlib import Path | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| BASE_DIR = Path(__file__).resolve().parent.parent | |
| SECRET_KEY = os.environ.get('SECRET_KEY', 'dev-secret-key-change-in-production') | |
| DEBUG = os.environ.get('DEBUG', 'False') == 'True' | |
| ALLOWED_HOSTS = ['*'] | |
| INSTALLED_APPS = [ | |
| 'django.contrib.contenttypes', | |
| 'django.contrib.auth', | |
| 'django.contrib.staticfiles', | |
| 'rest_framework', | |
| 'api', | |
| 'corsheaders', | |
| ] | |
| MIDDLEWARE = [ | |
| 'corsheaders.middleware.CorsMiddleware', | |
| 'django.middleware.security.SecurityMiddleware', | |
| 'whitenoise.middleware.WhiteNoiseMiddleware', | |
| 'django.middleware.common.CommonMiddleware', | |
| ] | |
| ROOT_URLCONF = 'core.urls' | |
| TEMPLATES = [{ | |
| 'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
| 'DIRS': [BASE_DIR / 'templates'] if (BASE_DIR / 'templates').exists() else [], | |
| 'APP_DIRS': True, | |
| 'OPTIONS': { | |
| 'context_processors': [ | |
| 'django.template.context_processors.request', | |
| ], | |
| }, | |
| }] | |
| WSGI_APPLICATION = 'core.wsgi.application' | |
| DATABASES = {} | |
| STATIC_URL = '/static/' | |
| STATICFILES_DIRS = [BASE_DIR / 'static'] if (BASE_DIR / 'static').exists() else [] | |
| STATIC_ROOT = BASE_DIR / 'staticfiles' | |
| STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' | |
| REST_FRAMEWORK = { | |
| 'DEFAULT_RENDERER_CLASSES': ['rest_framework.renderers.JSONRenderer'], | |
| 'DEFAULT_PARSER_CLASSES': [ | |
| 'rest_framework.parsers.MultiPartParser', | |
| 'rest_framework.parsers.JSONParser', | |
| ], | |
| } | |
| MODEL_PATH = BASE_DIR / 'model' / 'dermavision.onnx' | |
| GROQ_API_KEY = os.environ.get('GROQ_API_KEY', '') | |
| DATA_UPLOAD_MAX_MEMORY_SIZE = 20 * 1024 * 1024 | |
| CORS_ALLOW_ALL_ORIGINS = True # tighten this when deploying |