Entwicklungsumgebung
Richten Sie Ihre Entwicklungsumgebung für Mitwirkung an Duckling ein.
Voraussetzungen
- Python 3.10+
- Node.js 18+
- Git
Backend einrichten
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
Frontend einrichten
Entwicklungsserver starten
Backend
Backend läuft unter: http://localhost:5001
Frontend
Frontend läuft unter: http://localhost:3000
Projektstruktur
duckling/
├── backend/
│ ├── duckling.py # Flask-Einstieg der Anwendung
│ ├── config.py # Konfiguration
│ ├── models/ # Datenbankmodelle
│ ├── routes/ # API-Endpunkte
│ ├── services/ # Geschäftslogik
│ └── tests/ # Backend-Tests
├── frontend/
│ ├── src/
│ │ ├── components/ # React-Komponenten
│ │ ├── hooks/ # Eigene React-Hooks
│ │ ├── services/ # API-Client
│ │ └── types/ # TypeScript-Typen
│ └── tests/ # Frontend-Tests
└── docs/ # Dokumentation
IDE einrichten
VS Code
Empfohlene Erweiterungen:
- Python
- Pylance
- ESLint
- Prettier
- Tailwind CSS IntelliSense
Einstellungen
.vscode/settings.json:
{
"python.defaultInterpreterPath": "./backend/venv/bin/python",
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
Umgebungsvariablen
Legen Sie .env-Dateien für die lokale Entwicklung an:
Backend (.env)
Frontend (.env.local)
Hot Reload
Beide Server unterstützen Hot Reload:
- Backend: Flask-Debug-Modus lädt bei Dateiänderungen neu
- Frontend: Vite HMR aktualisiert Komponenten ohne Seitenreload
Debugging
Backend (VS Code)
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "duckling.py",
"FLASK_DEBUG": "1"
},
"args": ["run", "--port", "5001"],
"jinja": true,
"cwd": "${workspaceFolder}/backend"
}
]
}
Frontend
Browser-DevTools mit der Erweiterung React Developer Tools nutzen.