Update config

This commit is contained in:
Igor 2025-03-20 12:51:43 +01:00
parent 5d7d8f54d5
commit bddd16572d
3 changed files with 35 additions and 8 deletions

View File

@ -4,9 +4,11 @@
{% if cookiecutter.use_celery == 'y' -%}
import ssl
{%- endif %}
from datetime import timedelta
from pathlib import Path
import environ
from django.utils.translation import gettext_lazy as _
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
# {{ cookiecutter.project_slug }}/
@ -28,14 +30,11 @@ DEBUG = env.bool("DJANGO_DEBUG", False)
# In Windows, this must be set to your system time zone.
TIME_ZONE = "{{ cookiecutter.timezone }}"
# https://docs.djangoproject.com/en/dev/ref/settings/#language-code
LANGUAGE_CODE = "en-us"
LANGUAGE_CODE = "sr-latn"
# https://docs.djangoproject.com/en/dev/ref/settings/#languages
# from django.utils.translation import gettext_lazy as _
# LANGUAGES = [
# ('en', _('English')),
# ('fr-fr', _('French')),
# ('pt-br', _('Portuguese')),
# ]
LANGUAGES = [
("sr-latn", _("Serbian")),
]
# https://docs.djangoproject.com/en/dev/ref/settings/#site-id
SITE_ID = 1
# https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
@ -97,6 +96,10 @@ THIRD_PARTY_APPS = [
"rest_framework.authtoken",
"corsheaders",
"drf_spectacular",
"dj_rest_auth",
"dj_rest_auth.registration",
"rest_framework_simplejwt",
"rest_framework_simplejwt.token_blacklist",
{%- endif %}
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}
"webpack_loader",
@ -240,6 +243,8 @@ CSRF_COOKIE_HTTPONLY = True
# https://docs.djangoproject.com/en/dev/ref/settings/#x-frame-options
X_FRAME_OPTIONS = "DENY"
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10_000
# EMAIL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
@ -367,6 +372,7 @@ STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"]
# django-rest-framework - https://www.django-rest-framework.org/api-guide/settings/
REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework_simplejwt.authentication.JWTAuthentication",
"rest_framework.authentication.SessionAuthentication",
"rest_framework.authentication.TokenAuthentication",
),
@ -374,6 +380,15 @@ REST_FRAMEWORK = {
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}
REST_AUTH = {
"USE_JWT": True,
"JWT_AUTH_HTTPONLY": False,
}
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(days=env.int("SIMPLE_JWT_ACCESS_TOKEN_LIFETIME", default=180)),
}
# django-cors-headers - https://github.com/adamchainz/django-cors-headers#setup
CORS_URLS_REGEX = r"^/api/.*$"

View File

@ -17,7 +17,7 @@ SECRET_KEY = env(
default="!!!SET DJANGO_SECRET_KEY!!!",
)
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"] # noqa: S104
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1", "*"] # noqa: S104
# CACHES
# ------------------------------------------------------------------------------

View File

@ -23,10 +23,19 @@ services:
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres
- path: ./.env # Use this .env file to override the values .envs/.local/.django
- required: false
ports:
- '8000:8000'
command: /start
interpreter:
<<: *django
profiles:
- interpreter
container_name: gebi_local_interpreter
ports: []
postgres:
build:
context: .
@ -38,6 +47,8 @@ services:
- {{ cookiecutter.project_slug }}_local_postgres_data_backups:/backups
env_file:
- ./.envs/.local/.postgres
ports:
- "5432:5432"
{%- if cookiecutter.use_mailpit == 'y' %}
@ -46,6 +57,7 @@ services:
container_name: {{ cookiecutter.project_slug }}_local_mailpit
ports:
- "8025:8025"
- "1025:1025"
{%- endif %}
{%- if cookiecutter.use_celery == 'y' %}