Spaces:
Sleeping
Sleeping
Upload 59 files
Browse files[UPD] updating app for security changes
- Dockerfile +3 -2
- app.py +7 -1
Dockerfile
CHANGED
|
@@ -29,5 +29,6 @@ COPY --chown=user . $HOME/app
|
|
| 29 |
# EXPOSEMOS EL PUERTO QUE USA HUGGING FACE
|
| 30 |
EXPOSE 7860
|
| 31 |
|
| 32 |
-
# COMANDO PARA INICIAR LA APP CON GUNICORN (
|
| 33 |
-
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|
|
|
|
|
|
| 29 |
# EXPOSEMOS EL PUERTO QUE USA HUGGING FACE
|
| 30 |
EXPOSE 7860
|
| 31 |
|
| 32 |
+
# COMANDO PARA INICIAR LA APP CON GUNICORN (Fuerza 1 solo trabajador para estabilidad de sesi贸n)
|
| 33 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "app:app"]
|
| 34 |
+
|
app.py
CHANGED
|
@@ -25,9 +25,15 @@ import os
|
|
| 25 |
app = Flask(__name__)
|
| 26 |
|
| 27 |
# CONFIGURACION DE SESIONES Y SEGURIDAD
|
| 28 |
-
# Para producci贸n
|
| 29 |
app.secret_key = "unexpo-computacion1-seccion37-clave-segura"
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Registramos los controladores (Blueprints)
|
| 32 |
# 'url_prefix' nos permite separar rutas l贸gicas f谩cilmente.
|
| 33 |
# 'auth' tendr谩 rutas como '/auth/login', '/auth/logout'
|
|
|
|
| 25 |
app = Flask(__name__)
|
| 26 |
|
| 27 |
# CONFIGURACION DE SESIONES Y SEGURIDAD
|
| 28 |
+
# Para producci贸n en Hugging Face (que usa iframes), necesitamos que las cookies sean estables y compatibles.
|
| 29 |
app.secret_key = "unexpo-computacion1-seccion37-clave-segura"
|
| 30 |
|
| 31 |
+
# Configuraciones para que la sesi贸n funcione dentro del iframe de Hugging Face
|
| 32 |
+
app.config.update(
|
| 33 |
+
SESSION_COOKIE_SAMESITE='None',
|
| 34 |
+
SESSION_COOKIE_SECURE=True
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
# Registramos los controladores (Blueprints)
|
| 38 |
# 'url_prefix' nos permite separar rutas l贸gicas f谩cilmente.
|
| 39 |
# 'auth' tendr谩 rutas como '/auth/login', '/auth/logout'
|