Spaces:
Running
Running
Configuracion para desplegar en Huggieface
Browse files- Dockerfile +19 -0
- cata_system/settings.py +3 -3
- create_superuser.py +14 -0
- requirements.txt +0 -0
Dockerfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
COPY . .
|
| 6 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
+
|
| 8 |
+
RUN python manege.py migrate
|
| 9 |
+
|
| 10 |
+
RUN python manage.py tailwind build
|
| 11 |
+
|
| 12 |
+
RUN python manage.py collectstatic --noinput
|
| 13 |
+
|
| 14 |
+
RUN python manege.py shell < create_superuser.py
|
| 15 |
+
|
| 16 |
+
EXPOSE 7860
|
| 17 |
+
|
| 18 |
+
# Comando de inicio (usar gunicorn en vez de runserver en producción)
|
| 19 |
+
CMD ["gunicorn", "cata_system.wsgi:tecnicas", "--bind", "0.0.0.0:7860"]
|
cata_system/settings.py
CHANGED
|
@@ -28,9 +28,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|
| 28 |
SECRET_KEY = 'django-insecure-u)t2290d+c@$$7@!%@m&=w44$a@haxew8$!!tggh!up-+0-ll('
|
| 29 |
|
| 30 |
# SECURITY WARNING: don't run with debug turned on in production!
|
| 31 |
-
DEBUG =
|
| 32 |
|
| 33 |
-
ALLOWED_HOSTS = []
|
| 34 |
|
| 35 |
# SESSIONS TIMEOUT
|
| 36 |
SESSION_COOKIE_AGE = 30 * 60
|
|
@@ -57,7 +57,7 @@ INSTALLED_APPS = [
|
|
| 57 |
]
|
| 58 |
|
| 59 |
TAILWIND_APP_NAME = 'theme'
|
| 60 |
-
NPM_BIN_PATH = '
|
| 61 |
|
| 62 |
MIDDLEWARE = [
|
| 63 |
'django.middleware.security.SecurityMiddleware',
|
|
|
|
| 28 |
SECRET_KEY = 'django-insecure-u)t2290d+c@$$7@!%@m&=w44$a@haxew8$!!tggh!up-+0-ll('
|
| 29 |
|
| 30 |
# SECURITY WARNING: don't run with debug turned on in production!
|
| 31 |
+
DEBUG = False
|
| 32 |
|
| 33 |
+
ALLOWED_HOSTS = ["*"]
|
| 34 |
|
| 35 |
# SESSIONS TIMEOUT
|
| 36 |
SESSION_COOKIE_AGE = 30 * 60
|
|
|
|
| 57 |
]
|
| 58 |
|
| 59 |
TAILWIND_APP_NAME = 'theme'
|
| 60 |
+
NPM_BIN_PATH = 'npm'
|
| 61 |
|
| 62 |
MIDDLEWARE = [
|
| 63 |
'django.middleware.security.SecurityMiddleware',
|
create_superuser.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.contrib.auth import get_user_model
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
User = get_user_model()
|
| 5 |
+
|
| 6 |
+
username = os.getenv("SUPERUSER_USERNAME", "admin")
|
| 7 |
+
email = os.getenv("SUPERUSER_EMAIL", "admin@example.com")
|
| 8 |
+
password = os.getenv("SUPERUSER_PASSWORD", "admin123")
|
| 9 |
+
|
| 10 |
+
if not User.objects.filter(username=username).exists():
|
| 11 |
+
User.objects.create_superuser(username=username, email=email, password=password)
|
| 12 |
+
print("Superusuario creado")
|
| 13 |
+
else:
|
| 14 |
+
print("Superusuario existente")
|
requirements.txt
CHANGED
|
Binary files a/requirements.txt and b/requirements.txt differ
|
|
|