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:
Poker Design Developer
2026-05-31 17:26:45 +08:00
parent 3aa2eadc52
commit d10ee0e0fe
4 changed files with 18 additions and 5 deletions

View File

@@ -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',

View File

@@ -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: