How shankar1906/python-to-desktop-app works
Purpose and topology
This repository packages an industrial two-station valve-testing and monitoring system as a Windows desktop application. Its primary architecture is a Django backend with server-rendered pages and JSON APIs, persisted in MySQL, then hosted locally and displayed by a Tauri desktop shell. The legacy database structure is represented by L-T_60MT_2Station/standard_app/models.py and the included SQL dump L-T_60MT_2Station/dump-landt60mt-2station-202605070959.sql.
Runtime entry points
Django starts through L-T_60MT_2Station/manage.py; production/local backend launching is likely centralized in L-T_60MT_2Station/start_backend.py, with WSGI/ASGI deployment adapters in L-T_60MT_2Station/standard_soft/wsgi.py and L-T_60MT_2Station/standard_soft/asgi.py. Tauri’s Rust process enters at L-T_60MT_2Station/desktop/L-T-60MT-2Station/src-tauri/src/main.rs, while its webview UI begins at L-T_60MT_2Station/desktop/L-T-60MT-2Station/src/main.js.
Django composition and routing boundary
standard_soft is the project host: settings and root URL composition reside in L-T_60MT_2Station/standard_soft/settings.py and L-T_60MT_2Station/standard_soft/urls.py. standard_app owns domain behavior. Routing is deliberately split between rendered operator/admin pages under L-T_60MT_2Station/standard_app/urls/pages/ and machine/AJAX-facing endpoints under L-T_60MT_2Station/standard_app/urls/api/; these route families terminate in corresponding page and API view packages.
Valve-test workflow
The central control flow appears to be valve identification/configuration, Station 1 data capture, continuation into Station 2, cycle completion, and persistence/reporting. The workflow boundary is expressed through views such as L-T_60MT_2Station/standard_app/views/api/save_station1_form_api_views.py, L-T_60MT_2Station/standard_app/views/api/continue_station2_api_views.py, and services including L-T_60MT_2Station/standard_app/services/save_station1_service.py, L-T_60MT_2Station/standard_app/services/continue_station1_service.py, and L-T_60MT_2Station/standard_app/services/cycle_complete_service.py.
Live monitoring, pressure, and alarms
Live and synchronized station displays are separate capabilities, with APIs/pages around L-T_60MT_2Station/standard_app/views/api_views/livepage_api_views.py, L-T_60MT_2Station/standard_app/views/api/syncpage_api_views.py, and L-T_60MT_2Station/standard_app/views/pages/livepage_page_view.py. Pressure-analysis serial integration is isolated in L-T_60MT_2Station/standard_app/services/pressure_analysis_serial_service.py; alarms are modeled and served through L-T_60MT_2Station/standard_app/services/alarm_service.py and L-T_60MT_2Station/standard_app/views/api/alarm_api_views.py.
Master data, identity, and SAP boundary
Valve definitions and test prerequisites are maintained as domain master data—valve details, class/type/size, gauges, instruments, standards, materials, and test types—backed by the shared model layer and dedicated services, e.g. L-T_60MT_2Station/standard_app/services/valve_details_service.py and L-T_60MT_2Station/standard_app/services/gauge_details_service.py. Authentication, user permissions/accounting, and page protection are separate concerns in L-T_60MT_2Station/standard_app/services/auth_service.py, L-T_60MT_2Station/standard_app/decorators.py, and L-T_60MT_2Station/standard_app/services/user_accounting_service.py. SAP integration is an external SOAP boundary, evidenced by L-T_60MT_2Station/standard_app/services/sap_service.py and WSDL contracts in L-T_60MT_2Station/standard_app/wsdl/.
Outputs, operations, and desktop hosting
Completed test data feeds dashboards, Excel exports, graph/PDF reports, and SAP/VTR-related output flows. Report-generation logic is separated in L-T_60MT_2Station/standard_app/services/excel_report_service.py, L-T_60MT_2Station/standard_app/services/pdf_service.py, and L-T_60MT_2Station/standard_app/services/merged_graph_pdf_service.py. Operational durability includes a daily database backup command at L-T_60MT_2Station/standard_app/management/commands/daily_db_backup.py. The Tauri layer is configured by L-T_60MT_2Station/desktop/L-T-60MT-2Station/src-tauri/tauri.conf.json and capability policy L-T_60MT_2Station/desktop/L-T-60MT-2Station/src-tauri/capabilities/default.json; it should remain a host/UI boundary rather than duplicating Django domain logic.
Components 19
Desktop Host
- Tauri desktop shell · Hosts the local backend and operator webview.
L-T_60MT_2Station/desktop/L-T-60MT-2Station/src-tauri/src/main.rs - Webview UI
L-T_60MT_2Station/desktop/L-T-60MT-2Station/src/main.js
Django Application
- Backend launcher
L-T_60MT_2Station/start_backend.py - Django entry point
L-T_60MT_2Station/manage.py - Project host
L-T_60MT_2Station/standard_soft/urls.py - Page routes and views · Operator and admin pages.
- JSON API routes and views
- Valve-test workflow APIs · Captures Station 1, continues Station 2, and completes cycles.
L-T_60MT_2Station/standard_app/views/api/save_station1_form_api_views.py - Test-cycle services
L-T_60MT_2Station/standard_app/services/cycle_complete_service.py - Live monitoring APIs · Serves live and synchronized station displays.
L-T_60MT_2Station/standard_app/views/api_views/livepage_api_views.py - Pressure serial analysis
L-T_60MT_2Station/standard_app/services/pressure_analysis_serial_service.py - Alarm service and API
L-T_60MT_2Station/standard_app/services/alarm_service.py - Valve and test master data · Maintains valve definitions, gauges, instruments, standards, and test prerequisites.
L-T_60MT_2Station/standard_app/services/valve_details_service.py - Authentication and permissions
L-T_60MT_2Station/standard_app/services/auth_service.py - Domain models · Represents the legacy valve-testing data structure.
L-T_60MT_2Station/standard_app/models.py - Reports and exports · Produces Excel, graph/PDF, and related completed-test outputs.
L-T_60MT_2Station/standard_app/services/excel_report_service.py - Daily database backup
L-T_60MT_2Station/standard_app/management/commands/daily_db_backup.py
External Systems
- MySQL database
- SAP SOAP integration
L-T_60MT_2Station/standard_app/services/sap_service.py
Connections 22
- Tauri desktop shell → Webview UI: displays
- Tauri desktop shell → Backend launcher: launches
- Backend launcher → Django entry point: starts
- Webview UI → Project host: uses local app
- Project host → Page routes and views: routes pages
- Project host → JSON API routes and views: routes APIs
- Page routes and views → Authentication and permissions: protects pages
- JSON API routes and views → Valve-test workflow APIs: dispatches
- JSON API routes and views → Live monitoring APIs: dispatches
- JSON API routes and views → Alarm service and API: dispatches
- Valve-test workflow APIs → Test-cycle services: executes cycle
- Test-cycle services → Valve and test master data: uses prerequisites
- Test-cycle services → Domain models: persists tests
- Live monitoring APIs → Pressure serial analysis: reads analysis
- Pressure serial analysis → Domain models: stores readings
- Alarm service and API → Domain models: reads and records
- Valve and test master data → Domain models: manages
- Authentication and permissions → Domain models: accounts and permissions
- Domain models → MySQL database: maps to
- Test-cycle services → Reports and exports: feeds completed tests
- Test-cycle services → SAP SOAP integration: sends SAP/VTR data
- Daily database backup → MySQL database: backs up daily