initial commit
This commit is contained in:
+5
-1
@@ -1,3 +1,7 @@
|
||||
CLOUDINARY_URL="cloudinary://658671916285379:_CwNDj4L2dE9yH90Ynj7slPlbo0@dkxbfoesf"
|
||||
SECRET_KEY="django-insecure-wa6p9d+go#+evjql%m(+e5eti$%z7yx2o#cbq8bsh!==icxua3"
|
||||
DEBUG="False"
|
||||
CLOUDINARY_CLOUD_NAME="dkxbfoesf"
|
||||
CLOUDINARY_API_KEY="658671916285379"
|
||||
CLOUDINARY_API_SECRET="_CwNDj4L2dE9yH90Ynj7slPlbo0"
|
||||
CLOUDINARY_URL="cloudinary://658671916285379:_CwNDj4L2dE9yH90Ynj7slPlbo0@dkxbfoesf"
|
||||
DATABASE_URL="postgresql://civicfix_user:YG56PWj9Xj1DvYIKF35TKmIEjrsfis6d@dpg-d2mpapripnbc73f5vaj0-a/civicfix"
|
||||
@@ -1,29 +1,19 @@
|
||||
import dj_database_url, os
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
from pathlib import Path
|
||||
import dj_database_url
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
# Load .env file (for local dev only, Render will use Environment tab)
|
||||
load_dotenv()
|
||||
|
||||
CLOUDINARY_URL = os.getenv("CLOUDINARY_URL")
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
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"]
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = os.getenv("SECRET_KEY")
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
# Installed apps
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
@@ -32,30 +22,27 @@ INSTALLED_APPS = [
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'core.apps.CoreConfig',
|
||||
|
||||
# Third-party
|
||||
'cloudinary',
|
||||
'cloudinary_storage',
|
||||
'whitenoise.runserver_nostatic',
|
||||
|
||||
# Local apps
|
||||
'core.apps.CoreConfig',
|
||||
]
|
||||
|
||||
CLOUDINARY_STORAGE = {
|
||||
'CLOUD_NAME': ' dkxbfoesf',
|
||||
'API_KEY': '658671916285379',
|
||||
'API_SECRET': '_CwNDj4L2dE9yH90Ynj7slPlbo0',
|
||||
}
|
||||
|
||||
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
|
||||
|
||||
AUTH_USER_MODEL = 'core.User'
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
'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',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'civicfix.urls'
|
||||
@@ -63,7 +50,7 @@ ROOT_URLCONF = 'civicfix.urls'
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates')],
|
||||
'DIRS': [BASE_DIR / 'templates'],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
@@ -77,62 +64,48 @@ TEMPLATES = [
|
||||
|
||||
WSGI_APPLICATION = 'civicfix.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||
|
||||
# Database (Render Postgres, fallback to SQLite locally)
|
||||
DATABASES = {
|
||||
"default": dj_database_url.config(
|
||||
default=os.environ.get("DATABASE_URL")
|
||||
default=os.environ.get("DATABASE_URL"),
|
||||
conn_max_age=600,
|
||||
ssl_require=True,
|
||||
)
|
||||
}
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||
|
||||
# Password validators
|
||||
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',
|
||||
},
|
||||
{'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'},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||
|
||||
# Static & Media files
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||
# Cloudinary config (use environment variables, not hardcoded keys)
|
||||
CLOUDINARY_STORAGE = {
|
||||
'CLOUD_NAME': os.getenv("CLOUDINARY_CLOUD_NAME"),
|
||||
'API_KEY': os.getenv("CLOUDINARY_API_KEY"),
|
||||
'API_SECRET': os.getenv("CLOUDINARY_API_SECRET"),
|
||||
}
|
||||
|
||||
# Auth redirects
|
||||
LOGIN_REDIRECT_URL = 'citizen_dashboard'
|
||||
LOGIN_URL = 'login'
|
||||
LOGOUT_REDIRECT_URL = 'home'
|
||||
|
||||
# Default PK field
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
# Add these settings
|
||||
LOGIN_REDIRECT_URL = 'citizen_dashboard'
|
||||
LOGIN_URL = 'login'
|
||||
LOGOUT_REDIRECT_URL = 'home'
|
||||
Reference in New Issue
Block a user