Answer the question
In order to leave comments, you need to log in
How is the front connected to the back?
On the example of Django framework. I went through the basics, a backend was created there that accepted the request, in my case, for example localhost:8080/index
. Well, in the templates folder is the index.html file that my script returned. And now I can’t understand, how would html be the frontend ?? Ie it is necessary to write all JS here?? Or how does it happen?
Answer the question
In order to leave comments, you need to log in
I seem to understand your question. When I started, I couldn't figure out how to put it all together.
There just wasn't enough information. Tutorials were filled with syntax, but there was no explanation.
The logic turned out to be simple.
Usually there are 2 folders: frontend/backend.
In the frontend folder (static / static files. exaggerated -> because after the web server is running they cannot be changed) there is index.html, and all js, css files will be there.
Your API will be in the backend folder.
Now you need a web server. It's either nginx or built into django.
The web server "gives" first the static (in your case index.html) and then starts listening to the localhost:8080 port. And when requesting localhost:8080/index, it responds as you wrote, for example "hello world".
in index.html, you can add some kind of script, right inside the body tag. do Ideally, your string "Hello world" will turn out. You open the console and look.
Happened? Keep working, look, and then understanding will come by itself, the main thing is to make it work.
In fact, there is simply an abyss in knowledge. Try, look, look for a mentor, don't give up... one of the hardest moments at the beginning of training.
Well, yes. HZTML+JS - frontend, Django - backend.
What is the question?
Usually the frontend is in a completely different application and repository, they communicate using the REST API (variations are possible).
I have already thought of everything for a long time =) https://github.com/saintbyte/django_webpack_integration
There, in the README, the case of integrating Django into a modern webpack-type collector is perfectly described
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question