Fix Django API routing and authentication issues
- Add django.contrib.auth to INSTALLED_APPS - Fix URL routing structure for proper API endpoints - Add API root endpoint with endpoint information - Verify all API endpoints working correctly
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -15,6 +15,7 @@ ALLOWED_HOSTS = ['localhost', '127.0.0.1']
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.staticfiles',
|
||||
'rest_framework',
|
||||
'corsheaders',
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
from django.urls import path, include
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.http import JsonResponse
|
||||
|
||||
|
||||
def api_root(request):
|
||||
return JsonResponse({
|
||||
'message': 'Poker Card Design System API',
|
||||
'version': '1.0',
|
||||
'endpoints': {
|
||||
'projects': '/api/projects/',
|
||||
'templates': '/api/templates/',
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('api/', include([
|
||||
path('', include('apps.projects.urls')),
|
||||
path('', include('apps.templates.urls')),
|
||||
path('', include('apps.exports.urls')),
|
||||
])),
|
||||
path('', api_root),
|
||||
path('api/projects/', include('apps.projects.urls')),
|
||||
path('api/templates/', include('apps.templates.urls')),
|
||||
path('api/', include('apps.exports.urls')),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
|
||||
Reference in New Issue
Block a user