From 24687fe423c0ad648210a7db9ceed471d544ac1b Mon Sep 17 00:00:00 2001 From: Vinicius Aguiar Date: Sat, 28 Oct 2023 17:08:40 -0300 Subject: [PATCH] feat: move utils views to core app (#469) --- bd_api/apps/core/urls.py | 14 +++++++++++--- bd_api/apps/core/views/__init__.py | 3 +-- bd_api/urls.py | 15 ++------------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/bd_api/apps/core/urls.py b/bd_api/apps/core/urls.py index c46447e1..3df23cc8 100644 --- a/bd_api/apps/core/urls.py +++ b/bd_api/apps/core/urls.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from django.urls import path -from django.views.generic import RedirectView +from django.urls import include, path, re_path +from django.views.generic import RedirectView, TemplateView from bd_api.apps.core.views import ( DatasetCreateView, @@ -9,8 +9,16 @@ DatasetUpdateView, ) + +def render_robots(): + return TemplateView.as_view(template_name="robots.txt", content_type="text/plain") + + urlpatterns = [ - path("", RedirectView.as_view(url="admin", permanent=True)), + path("robots.txt", render_robots()), + re_path(r"^healthcheck/", include("health_check.urls")), + path("", RedirectView.as_view(url="admin", permanent=True), name="home"), + # path("dataset/", DatasetCreateView.as_view(), name="dataset"), path("dataset_redirect/", DatasetRedirectView.as_view(), name="dataset_redirect"), path("dataset//", DatasetUpdateView.as_view(), name="dataset_detail"), diff --git a/bd_api/apps/core/views/__init__.py b/bd_api/apps/core/views/__init__.py index 606bcde6..0c33c75a 100644 --- a/bd_api/apps/core/views/__init__.py +++ b/bd_api/apps/core/views/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- from .dataset_redirect import DatasetRedirectView # noqa: F401 -from .dataset_views import DatasetCreateView # noqa: F401 -from .dataset_views import DatasetDeleteView, DatasetUpdateView # noqa: F401 +from .dataset_views import DatasetCreateView, DatasetDeleteView, DatasetUpdateView # noqa: F401 diff --git a/bd_api/urls.py b/bd_api/urls.py index cc47fc4d..24785e2d 100644 --- a/bd_api/urls.py +++ b/bd_api/urls.py @@ -17,26 +17,15 @@ from django.conf import settings from django.conf.urls.static import static from django.contrib import admin -from django.urls import include, path, re_path -from django.views.generic.base import TemplateView +from django.urls import include, path from bd_api.apps.api.v1.views import DatasetESSearchView - -def render_robots(): - return TemplateView.as_view(template_name="robots.txt", content_type="text/plain") - - urlpatterns = [ - # Meta - path("robots.txt", render_robots()), - re_path(r"^healthcheck/", include("health_check.urls")), - # Admin path("admin/", admin.site.urls), - # Applications path("", include("bd_api.apps.core.urls")), - path("account/", include("bd_api.apps.account.urls")), path("api/", include("bd_api.apps.api.v1.urls")), + path("account/", include("bd_api.apps.account.urls")), path("search/", DatasetESSearchView.as_view()), path("search/debug/", include("haystack.urls")), path("payment/", include("bd_api.apps.payment.urls")),