diff --git a/Dockerfile b/Dockerfile index 7e7e742..a8c48b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11-slim +FROM python:3.13-slim ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 @@ -13,7 +13,7 @@ COPY --chown=appuser:appuser marbas /app/marbas COPY --chown=appuser:appuser sde /app/sde COPY --chown=appuser:appuser api /app/api COPY --chown=appuser:appuser authentication /app/authentication -COPY --chown=appuser:appuser static /app/static +#COPY --chown=appuser:appuser static /app/static USER appuser CMD ["uvicorn", "marbas.asgi:application", "--host", "0.0.0.0", "--port", "8000"] \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 994804c..80779c1 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -21,6 +21,9 @@ services: eveal: image: marbas:local + build: + context: . + dockerfile: Dockerfile env_file: - .env ports: diff --git a/marbas/settings.py b/marbas/settings.py index 41ce138..05c93b9 100644 --- a/marbas/settings.py +++ b/marbas/settings.py @@ -51,6 +51,7 @@ REST_FRAMEWORK = { 'mozilla_django_oidc.contrib.drf.OIDCAuthentication', 'rest_framework.authentication.SessionAuthentication', ], + 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', } INSTALLED_APPS = [ @@ -68,6 +69,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'django_filters', 'health_check', + 'drf_spectacular', 'rest_framework', ] diff --git a/marbas/urls.py b/marbas/urls.py index ea4876b..66ee0bf 100644 --- a/marbas/urls.py +++ b/marbas/urls.py @@ -18,6 +18,7 @@ from django.urls import include, path from django.conf import settings from django.conf.urls.static import static from django.contrib import admin +from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView from rest_framework.schemas import get_schema_view from django.views.generic import TemplateView @@ -28,18 +29,8 @@ urlpatterns = [ path('auth/', include("authentication.urls")), path('admin/', admin.site.urls), path('sso/', include('esi.urls', namespace='esi')), - path('openapi/', get_schema_view( - title="marbas", - description="API for EvEal", - version="0.0.9" - ), name='openapi-schema'), - path('swagger-ui/', TemplateView.as_view( - template_name='swagger-ui.html', - extra_context={'schema_url': 'openapi-schema'} - ), name='swagger-ui'), - path('redoc/', TemplateView.as_view( - template_name='redoc.html', - extra_context={'schema_url': 'openapi-schema'} - ), name='redoc'), + path('openapi/', SpectacularAPIView.as_view(), name='openapi-schema'), + path('swagger-ui/', SpectacularSwaggerView.as_view(url_name='openapi-schema'), name='swagger-ui'), + path('redoc/', SpectacularRedocView.as_view(url_name='openapi-schema'), name='redoc'), path('ht/', include('health_check.urls')), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/requirements.txt b/requirements.txt index 4c05897..7dffd83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ django djangorestframework django-filter +drf-spectacular markdown uvicorn[standard] psycopg[binary]