I’m new to Django and need to build an API backend for a React frontend. The customer specifically wants it done with Django. The project is straightforward: it should have around 15 endpoints, utilize Django’s ORM for connecting to a PostgreSQL database, include basic business logic, achieve at least 80% unit test coverage, and feature a Swagger UI. My challenge is to create an organized and standard directory structure following best practices. In .NET, I organize endpoints into controllers, create business logic with interfaces, and manage the data layer with models and entities. How can I achieve a similar structure in Django? Also, is using the Django REST framework recommended for this kind of project?
yo! django rest framework is perfect for ur project. it handles api stuff like a boss. for structure, try this:
project_root/
api/
models.py
serializers.py
views.py
services.py (for biz logic)
tests/
config/
settings.py
urls.py
this keeps things tidy. drf-yasg is great for swagger ui. good luck!
hey there! have you considered django rest framework? it’s handy for api projects like yours. what drew you to django, and how intricate is your business logic? maybe we can brainstorm some ideas for structuring your project?