Fix local development setup with django-ninja 0.22.x, Docker Postgres, and Swagger static assets#126
Open
ayu-yishu13 wants to merge 6 commits intom2b3:testfrom
Open
Fix local development setup with django-ninja 0.22.x, Docker Postgres, and Swagger static assets#126ayu-yishu13 wants to merge 6 commits intom2b3:testfrom
ayu-yishu13 wants to merge 6 commits intom2b3:testfrom
Conversation
Author
|
@bsureshkrishna |
|
Please discuss this on SciCommons; the issues to focus on etc. are being discussed there. Yes, since the backend is working stably for us for now, bringing the official repo up to date is medium priority. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #125
This PR fixes multiple local development issues that surfaced after aligning Django-ninja with the version currently compatible with the existing codebase.
->The changes were made after discussion confirming that the code should remain unchanged and the dependency version should be pinned to Django-ninja 0.22.x.
Issues Addressed:-
Dependency incompatibility (Django-ninja 1.x)
-pyproject.toml updated to pin Django-ninja to 0.22.x
File upload parameter compatibility
-After pinning Django-ninja to 0.22.x, endpoints using UploadedFile = File(None) required adjustment
-Updated API files to ensure compatibility:
-users/api.py
-articles/api.py
-communities/api.py
Docker local development missing PostgreSQL service
-docker-compose.dev.yml did not include a Postgres service, causing DB connection failures in local setup
-Added a Postgres service aligned with existing environment variable configuration
-Updated service dependencies accordingly
Swagger UI static assets not loading
-Swagger UI was loading HTML responses instead of CSS/JS (MIME type error)
-Fixed by:
Correcting static file configuration
Enabling WhiteNoise static handling
Removing incompatible Ninja middleware
Swagger UI now loads correctly
What Was Changed:-
1)pyproject.toml
→ Pin Django-ninja to 0.22.x
2)docker-compose.dev.yml
→ Add PostgreSQL service for local development
3)users/api.py, articles/api.py, communities/api.py
→ Fix file upload parameter definitions for compatibility
4)myapp/settings.py


→ Static files & middleware adjustments for Swagger UI