0

I just finished my second React course and become more confident with it by creating a several web application. Now my plan is to go fullstack, I decided to start learning Django because am kinda good with python, the course is really straight forward and well explained, the problem started with lectures talking about DTL (Django Template Language), i ended up getting lost and bored because am already familiar with front-end library, is there any course that focuses on backend development side of django ?

I tried to follow with those lectures and did understand but it conflict with my React knowledge

6
  • 1
    It's a decade out of date, but you might find some useful information here: stackoverflow.com/q/20361295/12975140 Commented Jul 8 at 20:28
  • 2
    Integrating a React frontend with Django is a fairly complex problem, especially for someone new to programming. I'd recommend learning Django's template language for now, until you are comfortable with Django. Commented Jul 8 at 20:30
  • 1
    That is because Django's templates are rendered at the server side, so not very dynamic. They are therefore quite the opposite of react. In order to harmonize the two, you typically design an API in Django, and let a react/vue/angular/... app handle the frontend. Commented Jul 8 at 21:01
  • 1
    As for the course, just ignore the templates. I don't find the template language itself particularly useful tbh, it also has a lot of caveats and "backwards compatibility issues", and is also suprisingly slow. Commented Jul 8 at 21:02
  • 1
    @MohammadYazbeck: well I think if you don't want to use the Django template language, you can skip anything that renders templates. After all, it is just presenting stuff in a nice manner, and processing form data. Both are then not really necessary, so then it is more database management, which can be done completely independent from the template language. Commented Jul 8 at 21:15

1 Answer 1

2

the problem started with lectures talking about DTL (Django Template Language).

Well letting the server render the templates is a bit "oldskool", before front-end frameworks became widespread like Angular, React, Vue, etc. In the "old days", the server rendered the entire HTML part. Django still works with the same principle. Whereas Angular, React and Vue essentially assume the backend provides an API with the data, not a webpage, and then the front-end makes some nice-looking webpage from these data source(s).

The old way of rendering templates is however far from dead, and actually is even reincarnating: web frameworks like Alpine.js and HTMX to make it easy to implement some level of interactivity in backend-rendered HTML, which often is suprisingly hard.

If you want to use a front-end library like React, Vue, Angular, etc. I would suggest you more or less skip the template rendering parts, since these are not very useful for that, and likely not really necessary. In that case look for a course (perhaps it is already part of that course) that implements REST APIs, for example with the Django REST API framework.

Another solution is to look for a combination of Django, Alpine and HTMX, this idea is now gathering more momentum, although I think it depends if the ecosystem can be built fast enough, before people move away from it again.

Not the answer you're looking for? Browse other questions tagged or ask your own question.