Skip to content
Advertisement

Connecting JavaScript with Django

I want to connect Django with JavaScript because I know a few tools that will help me with my applications and they work best with JavaScript I want to take all the urls and redirections with python and Django but I want some features working with JavaScript and possibly I might want to even want to connect my database with JavaScript. Most probably I will be using node.js and express. How can I connect JavaScript files with Django and make them work with each other and allow them to handle different parts of the web applications?

Advertisement

Answer

So you mean using Django as a “Backend” more or less to do more of the database, and heavy lifting, and then using Node.js (You could use React, or Angular if you wanted) for the frontend. To get django working just use a framework like Django-CORS. I even have a template for that on my github. And you would just call it like any RESTful API.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement