mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 07:11:08 -05:00
feat: Add PrimeProgress, PrimeSelect, and PrimeSkeleton components with customizable styles and props
- Implemented PrimeProgress component with support for labels, helper text, and various styles (size, variant, color). - Created PrimeSelect component with dropdown functionality, custom templates, and validation states. - Developed PrimeSkeleton component for loading placeholders with different shapes and animations. - Updated index.ts to export new components for easy import. - Enhanced PrimeVueTest.vue to include tests for new components and their functionalities. - Introduced a custom ThrillWiki theme for PrimeVue with tailored color schemes and component styles. - Added ambient type declarations for various components to improve TypeScript support.
This commit is contained in:
@@ -10,24 +10,27 @@ from decouple import config
|
||||
|
||||
# Initialize environment variables with better defaults
|
||||
|
||||
DEBUG = config('DEBUG', default=True)
|
||||
SECRET_KEY = config('SECRET_KEY')
|
||||
ALLOWED_HOSTS = config('ALLOWED_HOSTS')
|
||||
DATABASE_URL = config('DATABASE_URL')
|
||||
CACHE_URL = config('CACHE_URL', default="locmem://")
|
||||
EMAIL_URL = config('EMAIL_URL', default="console://")
|
||||
REDIS_URL = config('REDIS_URL', default="redis://127.0.0.1:6379/1")
|
||||
CORS_ALLOW_ALL_ORIGINS = config('CORS_ALLOW_ALL_ORIGINS', default=False, cast=bool)
|
||||
CORS_ALLOWED_ORIGINS = config('CORS_ALLOWED_ORIGINS', default=[])
|
||||
API_RATE_LIMIT_PER_MINUTE = config('API_RATE_LIMIT_PER_MINUTE', default=60)
|
||||
API_RATE_LIMIT_PER_HOUR = config('API_RATE_LIMIT_PER_HOUR', default=1000)
|
||||
CACHE_MIDDLEWARE_SECONDS = config('CACHE_MIDDLEWARE_SECONDS', default=300)
|
||||
DEBUG = config("DEBUG", default=True)
|
||||
SECRET_KEY = config("SECRET_KEY")
|
||||
ALLOWED_HOSTS = config("ALLOWED_HOSTS")
|
||||
DATABASE_URL = config("DATABASE_URL")
|
||||
CACHE_URL = config("CACHE_URL", default="locmem://")
|
||||
EMAIL_URL = config("EMAIL_URL", default="console://")
|
||||
REDIS_URL = config("REDIS_URL", default="redis://127.0.0.1:6379/1")
|
||||
CORS_ALLOW_ALL_ORIGINS = config("CORS_ALLOW_ALL_ORIGINS", default=False, cast=bool)
|
||||
CORS_ALLOWED_ORIGINS = config("CORS_ALLOWED_ORIGINS", default=[])
|
||||
API_RATE_LIMIT_PER_MINUTE = config("API_RATE_LIMIT_PER_MINUTE", default=60)
|
||||
API_RATE_LIMIT_PER_HOUR = config("API_RATE_LIMIT_PER_HOUR", default=1000)
|
||||
CACHE_MIDDLEWARE_SECONDS = config("CACHE_MIDDLEWARE_SECONDS", default=300)
|
||||
CACHE_MIDDLEWARE_KEY_PREFIX = config(
|
||||
'CACHE_MIDDLEWARE_KEY_PREFIX', default="thrillwiki")
|
||||
"CACHE_MIDDLEWARE_KEY_PREFIX", default="thrillwiki"
|
||||
)
|
||||
GDAL_LIBRARY_PATH = config(
|
||||
'GDAL_LIBRARY_PATH', default="/opt/homebrew/lib/libgdal.dylib")
|
||||
"GDAL_LIBRARY_PATH", default="/opt/homebrew/lib/libgdal.dylib"
|
||||
)
|
||||
GEOS_LIBRARY_PATH = config(
|
||||
'GEOS_LIBRARY_PATH', default="/opt/homebrew/lib/libgeos_c.dylib")
|
||||
"GEOS_LIBRARY_PATH", default="/opt/homebrew/lib/libgeos_c.dylib"
|
||||
)
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
@@ -38,14 +41,13 @@ if apps_dir.exists() and str(apps_dir) not in sys.path:
|
||||
sys.path.insert(0, str(apps_dir))
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = config('SECRET_KEY')
|
||||
SECRET_KEY = config("SECRET_KEY")
|
||||
|
||||
# Allowed hosts
|
||||
ALLOWED_HOSTS = config('ALLOWED_HOSTS')
|
||||
ALLOWED_HOSTS = config("ALLOWED_HOSTS")
|
||||
|
||||
# CSRF trusted origins
|
||||
CSRF_TRUSTED_ORIGINS = config('CSRF_TRUSTED_ORIGINS',
|
||||
default=[]) # type: ignore[arg-type]
|
||||
CSRF_TRUSTED_ORIGINS = config("CSRF_TRUSTED_ORIGINS", default=[]) # type: ignore[arg-type]
|
||||
|
||||
# Application definition
|
||||
DJANGO_APPS = [
|
||||
@@ -116,22 +118,46 @@ MIDDLEWARE = [
|
||||
|
||||
ROOT_URLCONF = "thrillwiki.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [BASE_DIR / "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",
|
||||
"moderation.context_processors.moderation_access",
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
# Add a toggle to enable/disable Django template support via env var
|
||||
# Use a distinct environment variable name so it doesn't collide with Django's TEMPLATES setting
|
||||
TEMPLATES_ENABLED = config("TEMPLATES_ENABLED", default=True, cast=bool)
|
||||
|
||||
# Conditional TEMPLATES configuration
|
||||
if TEMPLATES_ENABLED:
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [BASE_DIR / "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",
|
||||
"moderation.context_processors.moderation_access",
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
else:
|
||||
# When templates are disabled, we still need APP_DIRS=True for DRF Spectacular to work
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"APP_DIRS": True, # Changed from False to True to support DRF Spectacular templates
|
||||
"DIRS": [BASE_DIR / "templates/" / "404"],
|
||||
"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",
|
||||
"moderation.context_processors.moderation_access",
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = "thrillwiki.wsgi.application"
|
||||
|
||||
@@ -147,11 +173,12 @@ STORAGES = {
|
||||
},
|
||||
},
|
||||
}
|
||||
CLOUDFLARE_IMAGES_ACCOUNT_ID = config('CLOUDFLARE_IMAGES_ACCOUNT_ID')
|
||||
CLOUDFLARE_IMAGES_API_TOKEN = config('CLOUDFLARE_IMAGES_API_TOKEN')
|
||||
CLOUDFLARE_IMAGES_ACCOUNT_HASH = config('CLOUDFLARE_IMAGES_ACCOUNT_HASH')
|
||||
CLOUDFLARE_IMAGES_ACCOUNT_ID = config("CLOUDFLARE_IMAGES_ACCOUNT_ID")
|
||||
CLOUDFLARE_IMAGES_API_TOKEN = config("CLOUDFLARE_IMAGES_API_TOKEN")
|
||||
CLOUDFLARE_IMAGES_ACCOUNT_HASH = config("CLOUDFLARE_IMAGES_ACCOUNT_HASH")
|
||||
CLOUDFLARE_IMAGES_DOMAIN = config(
|
||||
'CLOUDFLARE_IMAGES_DOMAIN', default='imagedelivery.net')
|
||||
"CLOUDFLARE_IMAGES_DOMAIN", default="imagedelivery.net"
|
||||
)
|
||||
|
||||
# Password validation
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
@@ -250,7 +277,7 @@ TEST_RUNNER = "django.test.runner.DiscoverRunner"
|
||||
ROADTRIP_CACHE_TIMEOUT = 3600 * 24 # 24 hours for geocoding
|
||||
ROADTRIP_ROUTE_CACHE_TIMEOUT = 3600 * 6 # 6 hours for routes
|
||||
ROADTRIP_MAX_REQUESTS_PER_SECOND = 1 # Respect OSM rate limits
|
||||
ROADTRIP_USER_AGENT = config('ROADTRIP_USER_AGENT')
|
||||
ROADTRIP_USER_AGENT = config("ROADTRIP_USER_AGENT")
|
||||
ROADTRIP_REQUEST_TIMEOUT = 10 # seconds
|
||||
ROADTRIP_MAX_RETRIES = 3
|
||||
ROADTRIP_BACKOFF_FACTOR = 2
|
||||
@@ -290,17 +317,13 @@ REST_FRAMEWORK = {
|
||||
}
|
||||
|
||||
# CORS Settings for API
|
||||
CORS_ALLOWED_ORIGINS = config('CORS_ALLOWED_ORIGINS',
|
||||
default=[]) # type: ignore[arg-type]
|
||||
CORS_ALLOWED_ORIGINS = config("CORS_ALLOWED_ORIGINS", default=[]) # type: ignore[arg-type]
|
||||
CORS_ALLOW_CREDENTIALS = True
|
||||
CORS_ALLOW_ALL_ORIGINS = config(
|
||||
'CORS_ALLOW_ALL_ORIGINS', default=False, cast=bool) # type: ignore[arg-type]
|
||||
CORS_ALLOW_ALL_ORIGINS = config("CORS_ALLOW_ALL_ORIGINS", default=False, cast=bool) # type: ignore[arg-type]
|
||||
|
||||
|
||||
API_RATE_LIMIT_PER_MINUTE = config(
|
||||
'API_RATE_LIMIT_PER_MINUTE', default=60, cast=int) # type: ignore[arg-type]
|
||||
API_RATE_LIMIT_PER_HOUR = config(
|
||||
'API_RATE_LIMIT_PER_HOUR', default=1000, cast=int) # type: ignore[arg-type]
|
||||
API_RATE_LIMIT_PER_MINUTE = config("API_RATE_LIMIT_PER_MINUTE", default=60, cast=int) # type: ignore[arg-type]
|
||||
API_RATE_LIMIT_PER_HOUR = config("API_RATE_LIMIT_PER_HOUR", default=1000, cast=int) # type: ignore[arg-type]
|
||||
SPECTACULAR_SETTINGS = {
|
||||
"TITLE": "ThrillWiki API",
|
||||
"DESCRIPTION": "Comprehensive theme park and ride information API",
|
||||
@@ -314,24 +337,16 @@ SPECTACULAR_SETTINGS = {
|
||||
"name": "Statistics",
|
||||
"description": "Statistical endpoints providing aggregated data and insights",
|
||||
},
|
||||
{
|
||||
"name": "Reviews",
|
||||
"description": "User reviews and ratings for parks and rides",
|
||||
},
|
||||
{"name": "locations", "description": "Geographic location services"},
|
||||
{"name": "accounts", "description": "User account management"},
|
||||
{"name": "media", "description": "Media and image management"},
|
||||
{"name": "moderation", "description": "Content moderation"},
|
||||
],
|
||||
"SCHEMA_PATH_PREFIX": "/api/",
|
||||
"DEFAULT_GENERATOR_CLASS": "drf_spectacular.generators.SchemaGenerator",
|
||||
"DEFAULT_AUTO_SCHEMA": "api.v1.schema.ThrillWikiAutoSchema",
|
||||
"DEFAULT_AUTO_SCHEMA": "drf_spectacular.openapi.AutoSchema",
|
||||
"PREPROCESSING_HOOKS": [
|
||||
"api.v1.schema.custom_preprocessing_hook",
|
||||
],
|
||||
"POSTPROCESSING_HOOKS": [
|
||||
"api.v1.schema.custom_postprocessing_hook",
|
||||
],
|
||||
# "POSTPROCESSING_HOOKS": [
|
||||
# "api.v1.schema.custom_postprocessing_hook",
|
||||
# ],
|
||||
"SERVE_PERMISSIONS": ["rest_framework.permissions.AllowAny"],
|
||||
"SWAGGER_UI_SETTINGS": {
|
||||
"deepLinking": True,
|
||||
@@ -376,7 +391,7 @@ CACHES = {
|
||||
"BACKEND": DJANGO_REDIS_CACHE_BACKEND,
|
||||
# pyright: ignore[reportArgumentType]
|
||||
# type: ignore
|
||||
"LOCATION": config('REDIS_URL', default="redis://127.0.0.1:6379/1"),
|
||||
"LOCATION": config("REDIS_URL", default="redis://127.0.0.1:6379/1"),
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": DJANGO_REDIS_CLIENT_CLASS,
|
||||
"PARSER_CLASS": "redis.connection.HiredisParser",
|
||||
@@ -393,14 +408,14 @@ CACHES = {
|
||||
},
|
||||
"sessions": {
|
||||
"BACKEND": DJANGO_REDIS_CACHE_BACKEND,
|
||||
"LOCATION": config('REDIS_URL', default="redis://127.0.0.1:6379/2"),
|
||||
"LOCATION": config("REDIS_URL", default="redis://127.0.0.1:6379/2"),
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": DJANGO_REDIS_CLIENT_CLASS,
|
||||
},
|
||||
},
|
||||
"api": {
|
||||
"BACKEND": DJANGO_REDIS_CACHE_BACKEND,
|
||||
"LOCATION": config('REDIS_URL', default="redis://127.0.0.1:6379/3"),
|
||||
"LOCATION": config("REDIS_URL", default="redis://127.0.0.1:6379/3"),
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": DJANGO_REDIS_CLIENT_CLASS,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user