Spaces:
Runtime error
Runtime error
Download urls.py from OLETECH/BUSINESSTRACKER: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/OLETECH/BUSINESSTRACKER/resolve/main/urls.py
- Command line
-
hf download hf://spaces/OLETECH/BUSINESSTRACKER/urls.py
-
curl -L -o urls.py https://huggingface.co/spaces/OLETECH/BUSINESSTRACKER/resolve/main/urls.py
1.34 kB
| from django.contrib import admin | |
| from django.urls import path, include | |
| from django.http import HttpResponse | |
| from django.contrib.auth import get_user_model | |
| # Health check and Superuser Creator | |
| def home_view(request): | |
| User = get_user_model() | |
| message = "<h1>Business Tracker Backend is Up!</h1>" | |
| try: | |
| if not User.objects.filter(email='joshuaolega193@gmail.com').exists(): | |
| User.objects.create_superuser('joshuaolega193@gmail.com', 'YourSecurePassword123!') | |
| message += "<p style='color: green;'>Superuser 'joshuaolega193@gmail.com' created successfully!</p>" | |
| else: | |
| message += "<p>Superuser already exists.</p>" | |
| except Exception as e: | |
| message += f"<p style='color: red;'>Creation status: {e}</p>" | |
| message += "<p>Try <a href='/admin/'>/admin/</a></p>" | |
| return HttpResponse(message) | |
| urlpatterns = [ | |
| path('', home_view), | |
| path('admin/', admin.site.urls), | |
| # CHANGED: Removed 'users/' so paths match frontend (e.g., /api/login/) | |
| path('api/', include('users.urls')), | |
| path('api/dashboard/', include('dashboard.urls')), | |
| path('api/invoices/', include('invoices.urls')), | |
| path('api/receipts/', include('receipts.urls')), | |
| path('api/inventory/', include('inventory.urls')), | |
| path('api/reports/', include('reports.urls')), | |
| ] |