Compare commits
2 Commits
main
..
aa84422d10
| Author | SHA1 | Date | |
|---|---|---|---|
| aa84422d10 | |||
| ceff3cc1a0 |
+15
-33
@@ -1,10 +1,6 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import dj_database_url
|
||||
from dotenv import load_dotenv
|
||||
import cloudinary
|
||||
import cloudinary.uploader
|
||||
import cloudinary.api
|
||||
|
||||
# Load .env file (for local dev only, Render will use Environment tab)
|
||||
load_dotenv()
|
||||
@@ -12,9 +8,9 @@ load_dotenv()
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
# Security
|
||||
SECRET_KEY = os.getenv("SECRET_KEY", "unsafe-secret-key")
|
||||
DEBUG = os.getenv("DEBUG", "False") == "True"
|
||||
ALLOWED_HOSTS = ["*", "civicfix.onrender.com"]
|
||||
SECRET_KEY = os.getenv("SECRET_KEY")
|
||||
DEBUG = True
|
||||
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
|
||||
|
||||
# Installed apps
|
||||
INSTALLED_APPS = [
|
||||
@@ -24,19 +20,11 @@ INSTALLED_APPS = [
|
||||
'django.contrib.humanize',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'cloudinary',
|
||||
'cloudinary_storage',
|
||||
'django.contrib.staticfiles',
|
||||
'whitenoise.runserver_nostatic',
|
||||
'core.apps.CoreConfig',
|
||||
]
|
||||
|
||||
CLOUDINARY_STORAGE = {
|
||||
'CLOUD_NAME': os.getenv('CLOUD_NAME'),
|
||||
'API_KEY': os.getenv('API_KEY'),
|
||||
'API_SECRET': os.getenv('API_SECRET'),
|
||||
}
|
||||
|
||||
AUTH_USER_MODEL = 'core.User'
|
||||
|
||||
MIDDLEWARE = [
|
||||
@@ -69,13 +57,16 @@ TEMPLATES = [
|
||||
|
||||
WSGI_APPLICATION = 'civicfix.wsgi.application'
|
||||
|
||||
# Database (Render Postgres, fallback to SQLite locally)
|
||||
# Database (PostgreSQL for Local)
|
||||
DATABASES = {
|
||||
"default": dj_database_url.config(
|
||||
default=os.environ.get("DATABASE_URL"),
|
||||
conn_max_age=600,
|
||||
ssl_require=True,
|
||||
)
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': os.getenv("DB_NAME"),
|
||||
'USER': os.getenv("DB_USER"),
|
||||
'PASSWORD': os.getenv("DB_PASSWORD"),
|
||||
'HOST': os.getenv("DB_HOST"),
|
||||
'PORT': os.getenv("DB_PORT"),
|
||||
}
|
||||
}
|
||||
|
||||
# Password validators
|
||||
@@ -86,6 +77,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
{'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
TIME_ZONE = 'UTC'
|
||||
@@ -96,18 +88,8 @@ USE_TZ = True
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
|
||||
|
||||
cloudinary.config(
|
||||
cloud_name=os.getenv("CLOUD_NAME"),
|
||||
api_key=os.getenv("API_KEY"),
|
||||
api_secret=os.getenv("API_SECRET"),
|
||||
secure=True
|
||||
)
|
||||
|
||||
# Default storage (Cloudinary)
|
||||
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
|
||||
|
||||
MEDIA_URL = "/media/"
|
||||
MEDIA_ROOT = BASE_DIR / "media"
|
||||
|
||||
# Auth redirects
|
||||
LOGIN_REDIRECT_URL = 'citizen_dashboard'
|
||||
|
||||
Reference in New Issue
Block a user