welcome page included

pull/1755/head
adnanalameer16 2025-09-29 10:50:17 +05:30
rodzic 48e7f0f333
commit 187350faa6
2 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -7,6 +7,7 @@ from django.conf import settings
from django.conf.urls.static import static
from django.views.i18n import JavaScriptCatalog
from .views import serve_react_app, api_login, api_logout
from app.views.app import welcome, index
urlpatterns = [
# Admin panel - keep the original WebODM admin working
@ -19,6 +20,9 @@ urlpatterns = [
url(r'^jsi18n/', JavaScriptCatalog.as_view(packages=['app']), name='javascript-catalog'),
url(r'^i18n/', include('django.conf.urls.i18n')),
# Welcome page for first-time setup (must come before React app)
url(r'^welcome/$', welcome, name='welcome'),
# Auth JSON endpoints for new React frontend
url(r'^login/?$', api_login, name='api_login'),
url(r'^logout/?$', api_logout, name='api_logout'),

Wyświetl plik

@ -13,6 +13,14 @@ def serve_react_app(request):
Think of it as a waiter bringing your custom menu instead of the default menu
"""
try:
# Check if this is first access (no superusers exist)
from django.contrib.auth.models import User
from django.shortcuts import redirect
if User.objects.filter(is_superuser=True).count() == 0:
# First time setup needed - redirect to welcome page
return redirect('welcome')
# Find where your React app is built
base_dir = os.path.dirname(os.path.dirname(__file__)) # Go up two folders
index_path = os.path.join(base_dir, 'locane', 'dist', 'index.html')