K
K
ksksksks2019-03-28 18:36:20
Django
ksksksks, 2019-03-28 18:36:20

How to create a client for django server?

Hello, I just started getting acquainted with django, and python too. Actually, I made a simple blog using the MVT pattern, but the teacher demanded to redo it all and create a server on the rest framework, which I did, but what's next? How to convert json to objects? where do you even put it? how to remake an existing MVT project at minimal cost ... (only googles about the REST API, but I don’t understand what to do next)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Tikhonov, 2019-03-28
@tumbler

The teacher requires you to get rid of templates on the server and pass data through the REST API to the template engine on the frontend. In general, good luck with learning JS in a python course.

7
776166, 2019-04-04
@776166

It's complicated. :(
In a good way, you should use DRF, but it blows the hell out of the brains of the unprepared. There is a lot of things and too much variability. But you can do it with pens, but there are a lot of subtleties. For example, authorization, which will also blow your brain , if you do it manually. API is essentially just certain requests to the server to which it gives answers. Usually in JSON or parts of code (this is convenient for forms). On the other hand, mastering DRF is mandatory. You still have to. The sooner, the
better.The second problem is the need to learn some frameworks for the frontend, although, in the beginning, you can dig deeper with jQuery pens.
You can implement the task something like this: Take any page and transfer its functionality piece by piece from server rendering to rendering from data on the client. You request data from the server via API, it gives it to you, you render it with JS. It'll be hard. I sympathize.
If your models are good, then it will not be difficult for you to fasten a more or less full-fledged API.
But in general, the task is quite difficult. There you need to design and implement the API.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question