125 lines
3.5 KiB
Python
125 lines
3.5 KiB
Python
"""
|
|
Django settings for polisplexity project.
|
|
|
|
Generated by 'django-admin startproject' using Django 5.0.3.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/5.0/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/5.0/ref/settings/
|
|
"""
|
|
|
|
from pathlib import Path
|
|
import os
|
|
import dj_database_url
|
|
from dotenv import load_dotenv
|
|
|
|
# Load environment variables from .env file
|
|
load_dotenv()
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
BASE_URL = "https://app.polisplexity.tech"
|
|
|
|
# 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 = os.getenv("DEBUG") == "True"
|
|
|
|
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS", "").split(",")
|
|
|
|
# Application definition
|
|
INSTALLED_APPS = [
|
|
"django.contrib.admin",
|
|
"django.contrib.auth",
|
|
"django.contrib.contenttypes",
|
|
"django.contrib.sessions",
|
|
"django.contrib.messages",
|
|
"django.contrib.staticfiles",
|
|
"core",
|
|
"pxy_de",
|
|
"pxy_cr",
|
|
"pxy_whatsapp",
|
|
"pxy_city_digital_twins",
|
|
"pxy_bots",
|
|
"pxy_openai",
|
|
"pxy_meta_pages",
|
|
"pxy_langchain",
|
|
"pxy_neo4j",
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
"django.middleware.security.SecurityMiddleware",
|
|
"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",
|
|
]
|
|
|
|
ROOT_URLCONF = "polisplexity.urls"
|
|
|
|
TEMPLATES = [
|
|
{
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
"DIRS": [os.path.join(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",
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = "polisplexity.wsgi.application"
|
|
|
|
# Database Configuration
|
|
DATABASES = {
|
|
"default": dj_database_url.config(default=os.getenv("DATABASE_URL"))
|
|
}
|
|
|
|
# Password validation
|
|
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"},
|
|
]
|
|
|
|
# Internationalization
|
|
LANGUAGE_CODE = "en-us"
|
|
TIME_ZONE = "UTC"
|
|
USE_I18N = True
|
|
USE_TZ = True
|
|
|
|
# Static and Media Files
|
|
STATIC_URL = "/static/"
|
|
STATIC_ROOT = os.getenv("STATIC_ROOT", os.path.join(BASE_DIR, "static"))
|
|
|
|
MEDIA_URL = "/media/"
|
|
MEDIA_ROOT = os.getenv("MEDIA_ROOT", os.path.join(BASE_DIR, "media"))
|
|
|
|
# Default primary key field type
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
|
|
# Facebook API Tokens
|
|
PAGE_ACCESS_TOKEN = os.getenv("PAGE_ACCESS_TOKEN")
|
|
VERIFY_TOKEN = os.getenv("VERIFY_TOKEN")
|
|
|
|
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"
|
|
|
|
# Neo4j Database Configuration
|
|
NEO4J_URI = os.getenv("NEO4J_URI")
|
|
NEO4J_USERNAME = os.getenv("NEO4J_USERNAME")
|
|
NEO4J_PASSWORD = os.getenv("NEO4J_PASSWORD")
|
|
|
|
# OpenAI API Key
|
|
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|