|
1 | 1 | from django.contrib import admin # Import Django's admin interface module |
| 2 | + |
2 | 3 | # Import functions for URL routing and including other URL configs |
3 | 4 | from django.urls import path, include, re_path |
| 5 | + |
4 | 6 | # Import TemplateView for rendering templates |
5 | 7 | from django.views.generic import TemplateView |
6 | 8 | import importlib # Import the importlib module for dynamic module importing |
|
10 | 12 | # Map 'admin/' URL to the Django admin interface |
11 | 13 | path("admin/", admin.site.urls), |
12 | 14 | # Include Djoser's URL patterns under 'auth/' for basic auth |
13 | | - path('auth/', include('djoser.urls')), |
| 15 | + path("auth/", include("djoser.urls")), |
14 | 16 | # Include Djoser's JWT auth URL patterns under 'auth/' |
15 | | - path('auth/', include('djoser.urls.jwt')), |
| 17 | + path("auth/", include("djoser.urls.jwt")), |
16 | 18 | # Include Djoser's social auth URL patterns under 'auth/' |
17 | | - path('auth/', include('djoser.social.urls')), |
| 19 | + path("auth/", include("djoser.social.urls")), |
18 | 20 | ] |
19 | 21 |
|
20 | 22 | # List of application names for which URL patterns will be dynamically added |
21 | | -urls = ['conversations', 'feedback', 'listMeds', 'risk', |
22 | | - 'uploadFile', 'ai_promptStorage', 'ai_settings', 'embeddings', 'medRules', 'text_extraction'] |
| 23 | +urls = [ |
| 24 | + "conversations", |
| 25 | + "feedback", |
| 26 | + "listMeds", |
| 27 | + "risk", |
| 28 | + "uploadFile", |
| 29 | + "ai_promptStorage", |
| 30 | + "ai_settings", |
| 31 | + "embeddings", |
| 32 | + "medRules", |
| 33 | + "text_extraction", |
| 34 | + "assistants", |
| 35 | +] |
23 | 36 |
|
24 | 37 | # Loop through each application name and dynamically import and add its URL patterns |
25 | 38 | for url in urls: |
26 | 39 | # Dynamically import the URL module for each app |
27 | | - url_module = importlib.import_module(f'api.views.{url}.urls') |
| 40 | + url_module = importlib.import_module(f"api.views.{url}.urls") |
28 | 41 | # Append the URL patterns from each imported module |
29 | | - urlpatterns += getattr(url_module, 'urlpatterns', []) |
| 42 | + urlpatterns += getattr(url_module, "urlpatterns", []) |
30 | 43 |
|
31 | 44 | # Add a catch-all URL pattern for handling SPA (Single Page Application) routing |
32 | 45 | # Serve 'index.html' for any unmatched URL |
33 | 46 | urlpatterns += [ |
34 | | - re_path(r'^.*$', TemplateView.as_view(template_name='index.html')),] |
| 47 | + re_path(r"^.*$", TemplateView.as_view(template_name="index.html")), |
| 48 | +] |
0 commit comments