Compare commits
3 Commits
bc82249a29
...
508f3f028d
| Author | SHA1 | Date | |
|---|---|---|---|
| 508f3f028d | |||
| 7a151a4768 | |||
|
|
299428741b |
22
.claude/settings.local.json
Normal file
22
.claude/settings.local.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(gh auth:*)",
|
||||||
|
"Bash(git config:*)",
|
||||||
|
"Read(//c/Users/juanm/**)",
|
||||||
|
"Bash(cmdkey /list)",
|
||||||
|
"Bash(curl -s -X POST https://git.v-encore-lab.com/api/v1/repos/Proyecto-SaaS/django-core-base/pulls -H 'Authorization: token 3b78f0a988a74fcc251d4b5476dd54c7d98c26d2' -H 'Content-Type: application/json' -d '{\"title\":\"Merge pre-dev into dev\",\"head\":\"pre-dev\",\"base\":\"dev\",\"body\":\"Merge de pre-dev a dev\"}')",
|
||||||
|
"Bash(curl -s -X POST https://git.v-encore-lab.com/api/v1/repos/Proyecto-SaaS/django-core-base/pulls -H 'Authorization: token 3b78f0a988a74fcc251d4b5476dd54c7d98c26d2' -H 'Content-Type: application/json' -d '{\"title\":\"Merge dev into master\",\"head\":\"dev\",\"base\":\"master\",\"body\":\"Merge de dev a master\"}')",
|
||||||
|
"Bash(curl -s -X POST https://git.v-encore-lab.com/api/v1/repos/Proyecto-SaaS/django-core-base/pulls/28/merge -H 'Authorization: token 3b78f0a988a74fcc251d4b5476dd54c7d98c26d2' -H 'Content-Type: application/json' -d '{\"Do\":\"merge\",\"merge_message_field\":\"Merge pre-dev into dev\"}')",
|
||||||
|
"Bash(curl -s https://git.v-encore-lab.com/api/v1/repos/Proyecto-SaaS/django-core-base/pulls/28 -H 'Authorization: token 3b78f0a988a74fcc251d4b5476dd54c7d98c26d2')",
|
||||||
|
"Bash(python -c \"import sys,json; p=json.load\\(sys.stdin\\); print\\('merged:', p['merged'], '| state:', p['state']\\)\")",
|
||||||
|
"Bash(curl -s -X POST https://git.v-encore-lab.com/api/v1/repos/Proyecto-SaaS/django-core-base/pulls/29/merge -H 'Authorization: token 3b78f0a988a74fcc251d4b5476dd54c7d98c26d2' -H 'Content-Type: application/json' -d '{\"Do\":\"merge\",\"merge_message_field\":\"Merge dev into master\"}')",
|
||||||
|
"Bash(curl -s https://git.v-encore-lab.com/api/v1/repos/Proyecto-SaaS/django-core-base/pulls/29 -H 'Authorization: token 3b78f0a988a74fcc251d4b5476dd54c7d98c26d2')",
|
||||||
|
"Bash(mkdir -p app)",
|
||||||
|
"Bash(mv core:*)",
|
||||||
|
"Bash(mv apps/backend_admin app/backend_admin)",
|
||||||
|
"Bash(mv apps/common app/common)",
|
||||||
|
"Bash(mv apps/promociones app/promociones)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import os
|
import os
|
||||||
from django.core.asgi import get_asgi_application
|
from django.core.asgi import get_asgi_application
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api_config.settings')
|
||||||
application = get_asgi_application()
|
application = get_asgi_application()
|
||||||
@@ -56,9 +56,9 @@ INSTALLED_APPS = [
|
|||||||
'corsheaders',
|
'corsheaders',
|
||||||
|
|
||||||
# Tus Apps (Asegúrate de que el path sea correcto)
|
# Tus Apps (Asegúrate de que el path sea correcto)
|
||||||
'apps.promociones',
|
'promociones',
|
||||||
'apps.backend_admin',
|
'backend_admin',
|
||||||
'apps.common',
|
'common',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
@@ -72,7 +72,7 @@ MIDDLEWARE = [
|
|||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'core.urls'
|
ROOT_URLCONF = 'api_config.urls'
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
@@ -90,7 +90,7 @@ TEMPLATES = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
WSGI_APPLICATION = 'core.wsgi.application'
|
WSGI_APPLICATION = 'api_config.wsgi.application'
|
||||||
|
|
||||||
# 3. DATABASE
|
# 3. DATABASE
|
||||||
# Extraemos con fallback por si el .env falla
|
# Extraemos con fallback por si el .env falla
|
||||||
8
app/api_config/urls.py
Normal file
8
app/api_config/urls.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from django.urls import path, include
|
||||||
|
from backend_admin import views as admin_views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', include('backend_admin.urls')),
|
||||||
|
path('promociones/', include('promociones.urls')),
|
||||||
|
path('api/token/', admin_views.api_token, name='token_obtain_pair'),
|
||||||
|
]
|
||||||
@@ -2,6 +2,6 @@ import os
|
|||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
# Este es el enlace con tus configuraciones
|
# Este es el enlace con tus configuraciones
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api_config.settings')
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
@@ -6,7 +6,7 @@ import sys
|
|||||||
def main():
|
def main():
|
||||||
"""Run administrative tasks."""
|
"""Run administrative tasks."""
|
||||||
# Apuntamos a la configuración dentro de la carpeta 'core'
|
# Apuntamos a la configuración dentro de la carpeta 'core'
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api_config.settings')
|
||||||
try:
|
try:
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
from django.db import connection
|
from django.db import connection
|
||||||
from apps.common.utils import clean_sql_string, clean_sql_int
|
from common.utils import clean_sql_string, clean_sql_int
|
||||||
|
|
||||||
|
|
||||||
def get_status_action():
|
def get_status_action():
|
||||||
@@ -2,4 +2,4 @@ from django.apps import AppConfig
|
|||||||
|
|
||||||
class PromocionesConfig(AppConfig):
|
class PromocionesConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
name = 'apps.promociones'
|
name = 'promociones'
|
||||||
@@ -2,7 +2,7 @@ from rest_framework.views import APIView
|
|||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
from rest_framework_simplejwt.authentication import JWTAuthentication
|
from rest_framework_simplejwt.authentication import JWTAuthentication
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
from apps.backend_admin.models import Log
|
from backend_admin.models import Log
|
||||||
from .acciones import getData
|
from .acciones import getData
|
||||||
from django.utils import timezone # Esta es la forma correcta
|
from django.utils import timezone # Esta es la forma correcta
|
||||||
class PromocionObtener(APIView):
|
class PromocionObtener(APIView):
|
||||||
7
app/requirements.txt
Normal file
7
app/requirements.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Django==5.0.3
|
||||||
|
psycopg2-binary==2.9.9
|
||||||
|
gunicorn==21.2.0
|
||||||
|
python-dotenv==1.0.1
|
||||||
|
djangorestframework
|
||||||
|
django-cors-headers
|
||||||
|
djangorestframework-simplejwt
|
||||||
10
core/urls.py
10
core/urls.py
@@ -1,10 +0,0 @@
|
|||||||
from django.urls import path, include
|
|
||||||
from django.urls import path, include
|
|
||||||
from apps.backend_admin import views as admin_views
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
path('admin/', include('apps.backend_admin.urls')),
|
|
||||||
# AÑADE ESTA LÍNEA AQUÍ PARA QUE SEA UNA RUTA PRINCIPAL:
|
|
||||||
path('promociones/', include('apps.promociones.urls')),
|
|
||||||
path('api/token/', admin_views.api_token, name='token_obtain_pair'),
|
|
||||||
]
|
|
||||||
@@ -22,14 +22,14 @@ COPY deployments/requirements.txt .
|
|||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# 6. COPIAR EL CÓDIGO
|
# 6. COPIAR EL CÓDIGO
|
||||||
# Copiamos todo el contenido de la raíz (.) al directorio de trabajo (/app)
|
|
||||||
# Esto incluirá apps/, core/, manage.py, etc.
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Cambiamos al directorio de la app donde está manage.py
|
||||||
|
WORKDIR /app/app
|
||||||
|
|
||||||
# 7. EXPOSICIÓN Y SCRIPT DE ENTRADA
|
# 7. EXPOSICIÓN Y SCRIPT DE ENTRADA
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# El entrypoint también está en deployments/
|
|
||||||
COPY deployments/entrypoint.sh /entrypoint.sh
|
COPY deployments/entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user