- Add LandVerpachtung model with Land and Paechter relationships - Implement full CRUD operations for Verpachtungen - Add responsive Bootstrap templates with JavaScript calculations - Integrate document linking functionality similar to other entities - Add navigation links and URL patterns - Include CSV import support for Paechter data - Fix template encoding issues for proper UTF-8 support - Enhance administration interface with Verpachtung CSV import This implements the complete Verpachtung management feature requested, allowing users to manage land lease agreements with proper relationships to properties (Laenderei) and tenants (Paechter), following the same patterns as Foerderung/Destinataer relationships.
3.8 KiB
3.8 KiB
🚀 Development Workflow Guide
🔄 Complete Development Process
Step 1: Make Changes Safely (Local Development)
# 1. Start development environment (isolated from production)
docker-compose -f compose.dev.yml up -d
# 2. Make your code changes in the /app directory
# - Edit Python files, templates, models, etc.
# - Changes automatically reload in development server
# 3. Test your changes
# - Access: http://localhost:8081 (Django app)
# - Access: http://localhost:8082 (Paperless)
# - Database: localhost:5433 (completely separate from production)
# 4. Run tests if needed
docker-compose -f compose.dev.yml exec web python manage.py test
# 5. When done testing, stop development
docker-compose -f compose.dev.yml down
Step 2: Commit Changes (Git Version Control)
# 1. Stage your changes
git add .
# 2. Commit with descriptive message
git commit -m "Add new feature: enhanced user management"
# 3. Push to GitHub (but NOT to main branch yet)
git push origin main
Step 3: Deploy to Production (Automated)
When you push to the main branch, GitHub Actions automatically:
- Builds the Docker images
- Runs tests (if any fail, deployment stops)
- Deploys to production server
- Preserves production database and secrets
- Updates only the code, not the data
🛡️ Environment Separation Details
Development Environment (compose.dev.yml)
- Database:
stiftung_dev(port 5433) - Data: Completely isolated test data
- Secrets: Hardcoded safe values
- Purpose: Safe testing without any risk
Production Environment (compose.yml)
- Database:
stiftung(internal to server) - Data: Real user data (Destinatäre, Förderungen, etc.)
- Secrets: Secure tokens from server's .env file
- Purpose: Live system for real users
🔒 Safety Guarantees
What CAN'T Break Production:
✅ Code changes in development
✅ Database changes in development
✅ Testing new features locally
✅ Experimenting with different configurations
What COULD Affect Production:
⚠️ Pushing broken code to main branch
⚠️ Database migration issues (rare)
⚠️ Configuration changes in compose.yml
🧪 Testing New Features
For Small Changes:
- Edit code in
/appdirectory - Test in development (localhost:8081)
- If good → commit and push
For Database Changes:
- Create migration:
docker-compose -f compose.dev.yml exec web python manage.py makemigrations - Test migration:
docker-compose -f compose.dev.yml exec web python manage.py migrate - Verify in development environment
- If good → commit and push (migration will run automatically in production)
For Major Features:
- Create feature branch:
git checkout -b feature/new-feature - Develop and test extensively in development environment
- Create Pull Request on GitHub
- Review and merge to main when ready
🚀 Deployment Process
graph LR
A[Local Changes] --> B[Development Testing]
B --> C[Git Commit]
C --> D[Push to GitHub]
D --> E[GitHub Actions]
E --> F[Automatic Production Deployment]
F --> G[Live on vhtv-stiftung.de]
🆘 Emergency Procedures
If Something Breaks in Production:
- Rollback:
git revert <commit-hash>and push - Quick Fix: Make fix, test locally, commit and push
- Check Logs: GitHub Actions shows deployment logs
If Development Environment Has Issues:
- Reset:
docker-compose -f compose.dev.yml down -v - Rebuild:
docker-compose -f compose.dev.yml up -d --build - Re-migrate:
docker-compose -f compose.dev.yml exec web python manage.py migrate
📊 Current Status Check
# Check what's running
docker ps
# Development environment status
docker-compose -f compose.dev.yml ps
# View logs
docker-compose -f compose.dev.yml logs web