Browse Source

Arreglo nginx para funcionamiento con static

main
Celestino Rey 10 months ago
parent
commit
f81f0687ab
4 changed files with 11 additions and 11 deletions
  1. +2
    -0
      Dockerfile
  2. +3
    -3
      nginx/default.conf
  3. +5
    -5
      src/gestion_reservas/settings.py
  4. +1
    -3
      src/gestion_reservas/urls.py

+ 2
- 0
Dockerfile View File

@ -4,6 +4,8 @@ FROM python:3.11-slim
# install nginx
RUN apt-get update && apt-get install nginx netcat-openbsd -y
# copy our nginx configuration to overwrite nginx defaults
RUN rm /etc/nginx/sites-enabled/default
RUN rm /etc/nginx/sites-available/default
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
# link nginx logs to container stdout
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log


+ 3
- 3
nginx/default.conf View File

@ -6,7 +6,7 @@ error_log /var/log/nginx/error.log;
server {
listen 80;
server_name reymota.lab *.reymota.lab;
access_log /var/log/nginx/access.log;
location / {
@ -18,11 +18,11 @@ server {
}
location /static/ {
alias /app/wsgi/static/;
alias /app/staticfiles/;
}
location /media/ {
alias /app/wsgi/mediafiles/;
alias /app/mediafiles/;
}
error_page 500 502 503 504 /50x.html;


+ 5
- 5
src/gestion_reservas/settings.py View File

@ -132,8 +132,11 @@ THOUSAND_SEPARATOR = '.'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'wsgi', 'static')
STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / "staticfiles"
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / "mediafiles"
# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
@ -146,9 +149,6 @@ LOGOUT_REDIRECT_URL = 'principal'
AUTH_USER_MODEL = "reymotausers.ReyMotaUser"
MEDIA_ROOT = BASE_DIR / "media"
MEDIA_URL = '/media/'
CSRF_TRUSTED_ORIGINS = ["https://*.ocp-cluster.reymota.lab"]
# Configuración de correo con Gmail


+ 1
- 3
src/gestion_reservas/urls.py View File

@ -38,7 +38,5 @@ urlpatterns = [
path('api/proximo-evento/', views.proximo_evento, name='proximo_evento'),
path('api/todos-los-eventos/', views.todos_los_eventos, name='todos_los_eventos'),
]
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Loading…
Cancel
Save