Configuration Guide¶
This guide explains how to configure the MyCyclingCity application.
Environment Variables¶
Configuration is managed through environment variables, typically stored in a .env file.
Important:
- Production: The .env file is located outside the software in /data/appl/mcc/.env
- Development: The .env file can be in the project directory (mcc-web/.env) or individually configured
- The application automatically finds the .env file by searching relative to the project directory
Required Settings¶
SECRET_KEY¶
Django secret key for cryptographic signing. Never commit this to version control.
Generate a new secret key:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
DEBUG¶
Enable debug mode (development only):
ALLOWED_HOSTS¶
Comma-separated list of allowed hostnames:
Database Configuration¶
SQLite (Default - Development and Production)¶
The application uses SQLite for all environments. No additional configuration needed.
Production:
- Database file: /data/var/mcc/db/db.sqlite3
- The database is automatically created if it doesn't exist
Development:
- Database file: data/db.sqlite3 (relative to project directory)
- The application automatically finds the database in the project directory
Static and Media Files¶
STATIC_ROOT¶
Directory where static files are collected:
Production:
Development:
- Can be individually configured (e.g., mcc-web/staticfiles)
- The application uses relative paths in the project directory
MEDIA_ROOT¶
Directory for user-uploaded files:
Production:
Development:
- Can be individually configured (e.g., mcc-web/media)
- The application uses relative paths in the project directory
Note: In development environments, paths can be individual, as the application finds all information relative to the project directory.
Internationalization¶
Supported Languages¶
- German (de) - Default
- English (en)
Language Configuration¶
Configured in config/settings.py:
API Configuration¶
API Key¶
Global API key for device authentication:
Device-Specific API Keys¶
Configured in Django Admin under IoT → Device Configurations.
Email Configuration (Optional)¶
For email notifications:
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST=smtp.example.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@example.com
EMAIL_HOST_PASSWORD=your-password
Logging¶
Logging is configured in config/settings.py. Logs are written to:
logs/mcc_worker.log- Background worker logs- Console output (development)
Production Settings¶
Security Settings¶
DEBUG=False
ALLOWED_HOSTS=mycyclingcity.net,www.mycyclingcity.net
CSRF_TRUSTED_ORIGINS=https://mycyclingcity.net,https://www.mycyclingcity.net
SESSION_COOKIE_SECURE=True
CSRF_COOKIE_SECURE=True
Gunicorn Configuration¶
See config/gunicorn_config.py for production server settings.
The application is started via the script scripts/mcc-web.sh by the user configured by the administrator (e.g., mcc, www-data, etc.). The user mcc is not mandatory.
Environment-Specific Configuration¶
Development¶
Production¶
Configuration Files¶
.env- Environment variables (not in version control)- Production:
/data/appl/mcc/.env(outside the software) - Development:
mcc-web/.envor individually configured config/settings.py- Django settingsconfig/gunicorn_config.py- Gunicorn server configurationmkdocs.yml- Documentation configuration
Validation¶
Check configuration:
Next Steps¶
- Installation Guide - Return to installation
- Admin GUI Manual - Configure via admin interface
For production deployment, see the DEPLOYMENT.md file in this directory.