Merge app and project, use SQLite instead and
This commit is contained in:
parent
f0e7a35774
commit
4c16d14e61
29 changed files with 221 additions and 454 deletions
|
|
@ -7,22 +7,43 @@ from dotenv import find_dotenv, load_dotenv
|
|||
|
||||
load_dotenv(dotenv_path=find_dotenv(), verbose=True)
|
||||
|
||||
|
||||
# Run Django in debug mode
|
||||
DEBUG: bool = os.getenv(key="DEBUG", default="True").lower() == "true"
|
||||
|
||||
BASE_DIR: Path = Path(__file__).resolve().parent.parent
|
||||
|
||||
# The secret key is used for cryptographic signing, and should be set to a unique, unpredictable value.
|
||||
SECRET_KEY: str = os.getenv("SECRET_KEY", default="")
|
||||
ADMINS: list[tuple[str, str]] = [("Joakim Hellsén", "django@feedvault.se")]
|
||||
ALLOWED_HOSTS: list[str] = [".feedvault.se", ".localhost", "127.0.0.1"]
|
||||
CSRF_COOKIE_DOMAIN = ".feedvault.se"
|
||||
CSRF_TRUSTED_ORIGINS: list[str] = ["https://feedvault.se", "https://www.feedvault.se"]
|
||||
TIME_ZONE = "Europe/Stockholm"
|
||||
USE_TZ = True
|
||||
USE_I18N = False
|
||||
LANGUAGE_CODE = "en-us"
|
||||
DECIMAL_SEPARATOR = ","
|
||||
THOUSAND_SEPARATOR = " "
|
||||
EMAIL_HOST = "smtp.gmail.com"
|
||||
EMAIL_PORT = 587
|
||||
EMAIL_USE_TLS = True
|
||||
EMAIL_HOST_USER: str = os.getenv(key="EMAIL_HOST_USER", default="webmaster@localhost")
|
||||
EMAIL_HOST_PASSWORD: str = os.getenv(key="EMAIL_HOST_PASSWORD", default="")
|
||||
EMAIL_SUBJECT_PREFIX = "[FeedVault] "
|
||||
EMAIL_USE_LOCALTIME = True
|
||||
EMAIL_TIMEOUT = 10
|
||||
DEFAULT_FROM_EMAIL: str = os.getenv(key="EMAIL_HOST_USER", default="webmaster@localhost")
|
||||
SERVER_EMAIL: str = os.getenv(key="EMAIL_HOST_USER", default="webmaster@localhost")
|
||||
USE_X_FORWARDED_HOST = True
|
||||
INTERNAL_IPS: list[str] = ["127.0.0.1", "localhost"]
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
SITE_ID = 1
|
||||
PASSWORD_HASHERS: list[str] = ["django.contrib.auth.hashers.Argon2PasswordHasher"]
|
||||
ROOT_URLCONF = "feedvault.urls"
|
||||
WSGI_APPLICATION = "feedvault.wsgi.application"
|
||||
|
||||
INSTALLED_APPS: list[str] = [
|
||||
"feeds.apps.FeedsConfig",
|
||||
"feedvault.apps.FeedVaultConfig",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django.contrib.sitemaps",
|
||||
]
|
||||
|
||||
|
|
@ -36,22 +57,15 @@ MIDDLEWARE: list[str] = [
|
|||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = "feedvault.urls"
|
||||
|
||||
|
||||
WSGI_APPLICATION = "feedvault.wsgi.application"
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
|
||||
DATABASES: dict[str, dict[str, str]] = {
|
||||
database_folder: Path = BASE_DIR / "data"
|
||||
database_folder.mkdir(parents=True, exist_ok=True)
|
||||
DATABASES: dict[str, dict[str, str | Path | bool]] = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
"NAME": "feedvault",
|
||||
"USER": os.getenv(key="POSTGRES_USER", default=""),
|
||||
"PASSWORD": os.getenv(key="POSTGRES_PASSWORD", default=""),
|
||||
"HOST": os.getenv(key="POSTGRES_HOST", default=""),
|
||||
"PORT": os.getenv(key="POSTGRES_PORT", default="5432"),
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": database_folder / "feedvault.sqlite3",
|
||||
"ATOMIC_REQUESTS": True,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +100,7 @@ TEMPLATES = [
|
|||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"feeds.context_processors.add_global_context",
|
||||
"feedvault.context_processors.add_global_context",
|
||||
],
|
||||
"loaders": [
|
||||
(
|
||||
|
|
@ -100,62 +114,3 @@ TEMPLATES = [
|
|||
},
|
||||
},
|
||||
]
|
||||
|
||||
# A list of all the people who get code error notifications. When DEBUG=False and a view raises an exception, Django
|
||||
ADMINS: list[tuple[str, str]] = [("Joakim Hellsén", "django@feedvault.se")]
|
||||
|
||||
# A list of strings representing the host/domain names that this Django site can serve.
|
||||
# .feedvault.se will match *.feedvault.se and feedvault.se
|
||||
ALLOWED_HOSTS: list[str] = [".feedvault.se", ".localhost", "127.0.0.1"]
|
||||
CSRF_COOKIE_DOMAIN = ".feedvault.se"
|
||||
CSRF_TRUSTED_ORIGINS: list[str] = ["https://feedvault.se", "https://www.feedvault.se"]
|
||||
|
||||
# The time zone that Django will use to display datetimes in templates and to interpret datetimes entered in forms
|
||||
TIME_ZONE = "Europe/Stockholm"
|
||||
|
||||
# If datetimes will be timezone-aware by default. If True, Django will use timezone-aware datetimes internally.
|
||||
USE_TZ = True
|
||||
|
||||
# Don't use Django's translation system
|
||||
USE_I18N = False
|
||||
|
||||
# Decides which translation is served to all users.
|
||||
LANGUAGE_CODE = "en-us"
|
||||
|
||||
# Default decimal separator used when formatting decimal numbers.
|
||||
DECIMAL_SEPARATOR = ","
|
||||
|
||||
# Use a space as the thousand separator instead of a comma
|
||||
THOUSAND_SEPARATOR = " "
|
||||
|
||||
# Use gmail for sending emails
|
||||
EMAIL_HOST = "smtp.gmail.com"
|
||||
EMAIL_PORT = 587
|
||||
EMAIL_USE_TLS = True
|
||||
EMAIL_HOST_USER: str = os.getenv(key="EMAIL_HOST_USER", default="webmaster@localhost")
|
||||
EMAIL_HOST_PASSWORD: str = os.getenv(key="EMAIL_HOST_PASSWORD", default="")
|
||||
EMAIL_SUBJECT_PREFIX = "[FeedVault] "
|
||||
EMAIL_USE_LOCALTIME = True
|
||||
EMAIL_TIMEOUT = 10
|
||||
DEFAULT_FROM_EMAIL: str = os.getenv(key="EMAIL_HOST_USER", default="webmaster@localhost")
|
||||
SERVER_EMAIL: str = os.getenv(key="EMAIL_HOST_USER", default="webmaster@localhost")
|
||||
|
||||
# Use the X-Forwarded-Host header
|
||||
# USE_X_FORWARDED_HOST = True
|
||||
|
||||
# Set the Referrer Policy HTTP header on all responses that do not already have one.
|
||||
# SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin"
|
||||
|
||||
# Internal IPs that are allowed to see debug views
|
||||
INTERNAL_IPS: list[str] = ["127.0.0.1", "localhost"]
|
||||
|
||||
STATIC_URL = "static/"
|
||||
STATIC_ROOT: Path = BASE_DIR / "staticfiles"
|
||||
STATICFILES_DIRS: list[Path] = [BASE_DIR / "static"]
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
# Our site ID
|
||||
SITE_ID = 1
|
||||
|
||||
PASSWORD_HASHERS: list[str] = ["django.contrib.auth.hashers.Argon2PasswordHasher"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue