feat: added improvements from django-htmx-template
This commit is contained in:
@@ -49,7 +49,7 @@ if DEBUG:
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
'crochet.middleware.WhiteNoiseWithMediaMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
@@ -141,6 +141,11 @@ LANGUAGES = [
|
||||
('en', 'English'),
|
||||
]
|
||||
|
||||
# Un año (en vez del default de Django, de sesión: se perdía al cerrar el
|
||||
# navegador). La deja la vista "set_language" (ver config/urls.py) al elegir
|
||||
# idioma desde el selector del navbar (ver crochet/base.html).
|
||||
LANGUAGE_COOKIE_AGE = 60 * 60 * 24 * 365
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
@@ -12,11 +12,17 @@ env_file = BASE_DIR / '.env'
|
||||
if os.path.exists(env_file):
|
||||
environ.Env.read_env(env_file)
|
||||
|
||||
SECRET_KEY = env.str('SECRET_KEY', 'this-is-the-default-secret-key')
|
||||
SECRET_KEY = env.str('SECRET_KEY')
|
||||
DEBUG = env.bool('DEBUG', False)
|
||||
|
||||
CORS_ORIGIN_WHITELIST = env.str('CORS_ORIGIN_WHITELIST', 'http://localhost:8000').split(',')
|
||||
CSRF_TRUSTED_ORIGINS = env.str('CSRF_TRUSTED_ORIGINS', 'http://localhost:8000').split(',')
|
||||
# La cookie CSRF solo hace falta leerla desde JS en sitios que la mandan a
|
||||
# mano en una cabecera (fetch/XHR); aquí no la lee ningún script (los POST
|
||||
# de HTMX/fetch usan el token embebido en el HTML vía csrf_token, ver
|
||||
# account_settings.html/csrf.js), así que no hay motivo para exponerla al
|
||||
# DOM y sí para quitarle esa superficie a un XSS.
|
||||
CSRF_COOKIE_HTTPONLY = True
|
||||
|
||||
DATABASE_URL = env.db_url('DATABASE_URL', 'sqlite:///db.sqlite3')
|
||||
|
||||
@@ -24,7 +30,7 @@ REDIS_HOST = env.str('REDIS_HOST', 'redis')
|
||||
REDIS_PORT = env.str('REDIS_PORT', 6379)
|
||||
|
||||
PAGE_SIZE = env.int('PAGE_SIZE', 20)
|
||||
ALLOWED_HOSTS = env.str('ALLOWED_HOSTS', '*').split(',')
|
||||
ALLOWED_HOSTS = env.str('ALLOWED_HOSTS').split(',')
|
||||
|
||||
CELERY_BROKER_URL = env.str('CELERY_BROKER_URL', 'redis://172.17.0.1:6379/0')
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ urlpatterns = [
|
||||
view=TemplateView.as_view(template_name='manifest.json', content_type='application/manifest+json'),
|
||||
),
|
||||
path('offline/', name='offline', view=TemplateView.as_view(template_name='offline.html')),
|
||||
path('i18n/', include('django.conf.urls.i18n')),
|
||||
]
|
||||
|
||||
# i18n_patterns antepone el prefijo de idioma (/es/..., /en/...) a cada URL,
|
||||
|
||||
Reference in New Issue
Block a user