mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 15:31:08 -05:00
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
"""
|
|
Database configuration for thrillwiki project.
|
|
"""
|
|
|
|
import environ
|
|
|
|
env = environ.Env(
|
|
DATABASE_URL=(
|
|
str,
|
|
"postgis://thrillwiki_user:thrillwiki@localhost:5432/thrillwiki_test_db",
|
|
),
|
|
GDAL_LIBRARY_PATH=(str, "/opt/homebrew/lib/libgdal.dylib"),
|
|
GEOS_LIBRARY_PATH=(str, "/opt/homebrew/lib/libgeos_c.dylib"),
|
|
CACHE_URL=(str, "locmemcache://"),
|
|
CACHE_MIDDLEWARE_SECONDS=(int, 300),
|
|
CACHE_MIDDLEWARE_KEY_PREFIX=(str, "thrillwiki"),
|
|
)
|
|
|
|
# Database configuration
|
|
db_config = env.db("DATABASE_URL")
|
|
|
|
# Force PostGIS backend for spatial data support
|
|
db_config["ENGINE"] = "django.contrib.gis.db.backends.postgis"
|
|
|
|
DATABASES = {
|
|
"default": db_config,
|
|
}
|
|
|
|
# GeoDjango Settings - Environment specific with fallbacks
|
|
GDAL_LIBRARY_PATH = env("GDAL_LIBRARY_PATH")
|
|
GEOS_LIBRARY_PATH = env("GEOS_LIBRARY_PATH")
|
|
|
|
# Cache settings
|
|
CACHES = {"default": env.cache("CACHE_URL")}
|
|
|
|
CACHE_MIDDLEWARE_SECONDS = env.int("CACHE_MIDDLEWARE_SECONDS")
|
|
CACHE_MIDDLEWARE_KEY_PREFIX = env("CACHE_MIDDLEWARE_KEY_PREFIX")
|