Update routing in App component and adjust CORS settings in main.py; add project overview documentation
This commit is contained in:
parent
228b0deb24
commit
c5cd0494ad
|
@ -0,0 +1,59 @@
|
|||
# Project Overview
|
||||
|
||||
This project is a web-based application for monitoring and logging data from a Siemens S7 PLC. It consists of a Python backend and a React frontend.
|
||||
|
||||
**Backend:**
|
||||
|
||||
* **Framework:** Flask
|
||||
* **PLC Communication:** `python-snap7`
|
||||
* **Data Processing:** pandas, numpy
|
||||
* **Functionality:**
|
||||
* Provides a REST API for interacting with the PLC.
|
||||
* Streams data from the PLC in real-time.
|
||||
* Logs data to CSV files with rotation and cleanup.
|
||||
* Manages PLC and application configurations.
|
||||
* Serves the React frontend.
|
||||
|
||||
**Frontend:**
|
||||
|
||||
* **Framework:** React
|
||||
* **Build Tool:** Vite
|
||||
* **UI Library:** Chakra UI
|
||||
* **Charting:** Chart.js
|
||||
* **Internationalization:** i18next
|
||||
* **Functionality:**
|
||||
* Provides a user interface for configuring the PLC connection and data logging.
|
||||
* Displays real-time data from the PLC in charts.
|
||||
* Allows browsing and visualizing historical data.
|
||||
|
||||
# Building and Running
|
||||
|
||||
**1. Install Dependencies:**
|
||||
|
||||
* **Backend:** `pip install -r requirements.txt`
|
||||
* **Frontend:** `cd frontend && npm install`
|
||||
|
||||
**2. Build the Frontend:**
|
||||
|
||||
```bash
|
||||
cd frontend && npm run build
|
||||
```
|
||||
|
||||
**3. Run the Application:**
|
||||
|
||||
* **Development:**
|
||||
1. Start the backend: `python main.py`
|
||||
2. Start the frontend dev server: `cd frontend && npm run dev`
|
||||
* **Production (standalone executable):**
|
||||
1. Build the frontend as described above.
|
||||
2. Clean previous builds: `rmdir /s /q build dist`
|
||||
3. Run PyInstaller: `conda activate snap7v12; pyinstaller main.spec --clean`
|
||||
|
||||
The production build will create a single executable file in the `dist` directory.
|
||||
|
||||
# Development Conventions
|
||||
|
||||
* The backend follows a modular structure with a `core` directory containing the main application logic.
|
||||
* The frontend is located in the `frontend` directory and follows standard React project conventions.
|
||||
* Configuration is managed through JSON files in the `config/data` directory.
|
||||
* The application uses a rotating logger system for the backend, with logs stored in the `.logs` directory.
|
|
@ -26,7 +26,7 @@ function Home() {
|
|||
<Box>
|
||||
<Heading as="h2" size="sm" mb={2}>Acciones rápidas</Heading>
|
||||
<HStack spacing={2} flexWrap="wrap">
|
||||
<Button as="a" href="/app" colorScheme="blue" size="sm">Reload SPA</Button>
|
||||
<Button as="a" href="/" colorScheme="blue" size="sm">Reload SPA</Button>
|
||||
<Button as="a" href="/api/status" target="_blank" rel="noreferrer" variant="outline" size="sm">Ver /api/status</Button>
|
||||
</HStack>
|
||||
</Box>
|
||||
|
|
|
@ -15,7 +15,7 @@ createRoot(document.getElementById('root')).render(
|
|||
<React.StrictMode>
|
||||
<ColorModeScript initialColorMode={theme.config.initialColorMode} />
|
||||
<ChakraProvider theme={theme}>
|
||||
<BrowserRouter basename="/app">
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</ChakraProvider>
|
||||
|
|
Loading…
Reference in New Issue