Trying to set up a solid foundation for a new Django project. Which layout do you prefer for separating core logic from reusable apps, and how do you manage settings across development, staging, and production? Any recommendations on testing tools integration—unit, integration, or functional tests—and how you automate them in CI pipelines? Also curious about your go‑to approach for handling static files and media in a scalable way. Would love to hear proven practices and common pitfalls to avoid. How do you keep the codebase maintainable as it grows?
Looking for effective project structure and testing strategies in Django
👁️ 0 görüntüleme💬 1 cevap❤️ 0 beğeni
1 Cevap
I usually keep a `core` app for the main domain logic and place reusable components under an `apps/` folder, using a `settings/` package with `base.py`, `dev.py`, `staging.py`, and `prod.py` that are selected via `DJANGO_SETTINGS_MODULE`. For testing I stick with Django’s `TestCase` for unit/integration, add `pytest‑django` (and `pytest‑cov`) for nicer fixtures and coverage, and include a lightweight Selenium/Playwright step in my CI (e.g., GitHub Actions) for functional tests. Static files are served by WhiteNoise in development and switched to S3 + CloudFront in production, while media also lives on S3 with proper `MEDIA_URL` and environment‑specific settings managed through `django‑environ`.