1
3 Comments

How to use Django as a Backend?

I know Django can function as a full stack application: serving pages and handling requests in the backend.

I just want to use it as a backed for a React application. Do I just need the Django Rest Framework to create an API, or do I need other parts of Django?

Basically, I have quite a bit of experience with React and want to use Django and Postgres on the backend, but I'm not sure how to learn Django specifically for my needs other than the REST API portion of it.

Thanks in advance!

  1. 3

    Hey

    Django Rest Framework is an excellent place to start for a REST API in Django.

    The only core part of Django to concern yourself with (to begin with) would be the ORM and model architecture, everything else you can add as and when you need it. By this when you hit a problem (eg I think I need caching), I would then check the DRF docs and then the Django docs before looking at third party solutions.

    The admin is also very useful to track what is happening with your database.

    Finally this website is an invaluable reference once you are up and running with DRF (http://www.cdrf.co/)

  2. 2

    If the decision for Django is not final, yet, but you do want to go with Python, FastAPI might be a good fit: https://fastapi.tiangolo.com/

  3. 1

    Django can readily act as a backend serving JSON over an API.

    You do not necessarily need Django Rest Framework as could use JsonResponse (depends on your use case).

    Django Rest Framework is one option but not so straightforward imo.

    If you know GraphQL or have time to learn that could be a good option; you may be surprised how easy it is to use once setup.

    But yeah Django can do what you want.

    One question is how are you managing the data? Is it in files or a database. If latter will need to model in Django ORM, which isn't difficult.

    Django can also sometimes automatically reverse engineer models from an existing database.

Trending on Indie Hackers
Passed $7k 💵 in a month with my boring directory of job boards 34 comments Reaching $100k MRR Organically in 12 months 29 comments 87.7% of entrepreneurs struggle with at least one mental health issue 14 comments How to Secure #1 on Product Hunt: DO’s and DON'Ts / Experience from PitchBob – AI Pitch Deck Generator & Founders Co-Pilot 11 comments Competing with a substitute? 📌 Here are 4 ad examples you can use [from TOP to BOTTOM of funnel] 10 comments Are you wondering how to gain subscribers to a founder's X account from scratch? 9 comments