php and python app (for development only)
Current Status: Prototype / Development Alpha
This project represents a hybrid application architecture that bridges the gap between local desktop execution and dynamic web serving. The core concept is to run a lightweight Python web server (Flask) embedded within a PyQt5 WebEngineView, creating a desktop application whose UI is rendered via HTML/CSS/JS but retains full access to local system resources through the Python backend.
The architecture is inspired by tools like Electron but leverages Python's extensive ecosystem for data processing, system integration, and rapid backend development.
- Unified Codebase: Write your backend logic in Python and your frontend in standard web technologies.
- Local-First Capability: Perfect for internal tools, dashboards, data processing apps, or IoT controllers.
- Extensibility: Easily integrate PHP, Node.js, or any other local runtime alongside the Flask server.
project-root/
├── appserver.py # Flask backend server (API endpoints + static routes)
├── apis.py # Modular route definitions (imported into appserver)
├── config.py # Central configuration (paths, ports, directories)
├── myapp.py # PyQt5 WebEngineView browser container (Main Application)
├── windows.py # Alternate/legacy PyQt5 window implementation
├── runApp.bat # Batch launcher (starts server + GUI)
├── whatsNext.txt # Development roadmap / future feature list
├── templates/ # HTML/CSS/JS frontend files (served by Flask)
├── data/ # Persistent local data storage
├── temp/ # Temporary file storage
└── servers/ # External runtimes (e.g., php-8.2.6)
| Feature | Status | Location |
|---|---|---|
| Flask REST API server | ✅ Implemented | appserver.py |
| PyQt5 WebEngineView container | ✅ Implemented | myapp.py |
| Browser-style navigation (Back, Forward, Reload, Home) | ✅ Implemented | myapp.py |
| Dynamic URL bar with navigation | ✅ Implemented | myapp.py |
| Threaded server startup | ✅ Implemented | myapp.py |
| PHP server integration (via command line) | ✅ Prototype | start_server() in myapp.py |
| Sample CRUD API routes | ✅ Implemented | appserver.py |
| Centralized configuration | ✅ Implemented | config.py |
| Feature | Description |
|---|---|
| devMode & usermode | Separate development and production environments |
| Node.js integration | Live rendering / hot-reload for frontend frameworks |
| Local & temporary databases | SQLite, in-memory, or IndexedDB support |
| DNS System & Security | Local domain mapping, SSL, and request filtering |
- Python 3.8+
- PyQt5 and PyQtWebEngine:
pip install PyQt5 PyQtWebEngine Flask
- (Optional) PHP for legacy template serving – see
config["phpDir"]
- Configure paths (if necessary) in
config.py - Launch the application using the batch file:
Or manually:
runApp.bat
python myapp.py
config.pyloads application settings (port: 999, directories, etc.)myapp.pystarts a Flask server in a background thread usingappserver.py- PyQt5 launches a WebEngineView window pointing to
http://127.0.0.1:999 - The Flask server serves
templates/index.html(if exists) or fallback routes - API endpoints are accessible via
http://127.0.0.1:999/api/resource
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Returns a simple HTML string |
| GET | /api/resource |
Returns a sample JSON resource |
| POST | /api/resource |
Creates a new resource (expects JSON) |
| PUT | /api/resource/<id> |
Updates a resource |
| DELETE | /api/resource/<id> |
Deletes a resource |
- Thread Separation: The Flask server runs in a daemon thread, ensuring the GUI remains responsive.
- Configuration Centralization: All file paths, ports, and keys are managed in
config.py. - Extensible API Layout:
apis.pyis structured for modular route expansion without clutteringappserver.py. - Windows Compatibility: Paths use backslashes (
\\) andos.chdirensures relative paths work correctly.
windows.pyis currently incomplete – The port assignment logic contains errors (url.port(config[...])is invalid). Usemyapp.pyinstead.- PHP Server Integration: The command in
start_server()launches a blocking PHP server. Consider usingsubprocess.Popeninstead ofos.systemfor better control. - No Live Reload: Changes to backend code require a full restart.
- Security: The
passKeyinconfig.pyis hardcoded – move to environment variables for production.
If you wish to continue development:
- Start with
whatsNext.txt– This is your prioritized roadmap. - Refactor server management – Replace
os.systemwithsubprocess.Popenand implement graceful shutdown. - Add environment modes – Implement
devModevsusermodeto toggle debug features. - Implement local database layer – Use SQLite or TinyDB for persistent storage without external dependencies.
(Include your license here – e.g., MIT, GPL, etc.)
This project is built on:
Project Lead / Architect: LiderWally
Last Updated: 31/01/2026
For inquiries or contributions: wawakowero11@gmail.com