feat: add sensible defaults

This commit is contained in:
Saqibur Rahman 2024-11-05 15:13:26 +06:00
parent 5eca3ec130
commit 9982b25444
5 changed files with 50 additions and 14 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
# Current Project Ignores
.ruff_cache/
# OS ignores
*.DS_Store

View File

@ -10,8 +10,12 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import os
from pathlib import Path
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -20,28 +24,36 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = (
"django-insecure-$227hjjmuq2e!)o^@2&#2v#+(-=@$v362o@8g#s9!2)tjn1)1a"
)
SECRET_KEY = "django-insecure-$227hjjmuq2e!)o^@2&#2v#+(-=@$v362o@8g#s9!2)tjn1)1a"
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
DEFAULT_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
]
THIRD_PARTY_APPS = [
"rest_framework",
"corsheaders",
"storages",
"django_filters",
]
SELF_APPS = [
"apps.core",
]
INSTALLED_APPS = DEFAULT_APPS + THIRD_PARTY_APPS + SELF_APPS
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"corsheaders.middleware.CorsMiddleware", # Third-Party Middleware
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
@ -73,13 +85,13 @@ WSGI_APPLICATION = "config.wsgi.application"
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'your-db-name',
'USER': 'your-db-user',
'PASSWORD': 'your-db-user-password',
'HOST': 'your-db-host',
'PORT': 'your-db-port',
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "your-db-name",
"USER": "your-db-user",
"PASSWORD": "your-db-user-password",
"HOST": "your-db-host",
"PORT": "your-db-port",
}
}
@ -126,3 +138,14 @@ STATIC_URL = "static/"
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
DEBUG = True
### --- SENTRY SETTINGS --- ###
if not DEBUG:
sentry_sdk.init(
dsn=os.environ("SENTRY_DSN"),
integrations=[
DjangoIntegration(),
],
traces_sample_rate=0.5,
send_default_pii=False,
)

View File

@ -0,0 +1,3 @@
[pytest]
DJANGO_SETTINGS_MODULE = config.settings
python_files = tests.py test_*.py *_tests.py

View File

@ -0,0 +1,9 @@
Django
djangorestframework
django-cors-headers
django-filter
django-storages
psycopg2-binary==2.9.9
Pillow
sentry-sdk
gunicorn