How to control Django with Javascript? [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am building a web application with Django and I show the graphs in the website. The graphs are obtained from real time websites and is updated daily. I want to know how can I send graphs using matplotlib to template and add refresh option with javascript which will perform the web scraping script which I have written. The main question is which framework should I use? AJAX, Django REST, or what?

You're better off using a frontend framework and calling the backend for the data via JS. separating the front and backend is a more contemporary approach and has some advantages over doing it all in the backend.
From personal experience, it gets really messy mixing Python and JS in the same system.
Use Django as a Rest-ful backend, and try not to use AJAX in the frontend, then pick a frontend of your choice to deliver the web app.

Related

How to integrate a python interface on website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 months ago.
Improve this question
I made a Python interface and I'm trying to integrate it to a HTML/CSS website in a <div>, but I have no idea about how to do it.
Any idea? Do you know any solution ?
Thanks in advance
If you built a command-line interface (CLI) to your app, then you can expose it to the Internet via web framework like Flask in form of REST API. Then you can access it with JavaScript on the frontend side.
But If you've built a graphical user interface (GUI) using framework like Tkinter, it is nearly impossible to transfer it to the web page without rewriting the code. Anvil seems to be able to provide web a GUI for Python, but I haven't tried it yet.

How to develop a dynamic website without a server-side language? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm a beginner in web development. The only websites I've made are in HTML, CSS, JS and jQuery, and all of them are static (with all the data hard-coded in HTML or JS).
I want to build something more engaging, without using a server-side language like node.js or PHP connected to a database, maybe populating the info on a website from a CSV "database".
My question is, how can someone make a dynamic website without using a server-side language?
Of course it is possible - with JavaScript.
CSV reading How to read data From *.CSV file using javascript?
CSV reading http://papaparse.com/
JSON http://www.w3schools.com/js/js_json_intro.asp
AJAX http://www.w3schools.com/xml/ajax_intro.asp

Is there any advantage to use the Mantra.js architecture framework? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
Meteor.js integrates well inside a Mantra.js architecture, but does it have advantages since it slows the running of my requests.
For instance a dummy request in GraphQL (get a random string from the server) runs in few ms using Apollo Client and 1 second and more using Mantra.js (exact same request wrapping Apollo stack).
It only depends what kind of project you want to work on.
Mantra.js is an architecture framework for Meteor.js, that means :
it helps a developer to follow the creation and development of its modules corresponding to the Mantra framework. The developer is free to use any kind of front-end library he/she wants, any Data Query and Client caching he wants, but in my opinion, it doesn't really improve the quality of the code. Someone can organize a project with own rules and it can be maintainable easily.
So if your team is comfortable with your code structure you definitively don't need something like Mantra.js.

How should I structure .net website to use a web api? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm starting a project that will use a search bar to hit a web api and return the results. There will be no writing to the web api.
My biggest struggle when creating a new project is how it should be laid out. I never know when i should create a DAO, do it all via javascript, put it in a controller, etc.
For developing something like a search engine or any web application. You would need following:
A frontend, which is your application's GUI in browser of user or mobile application.
A backend logic, this could be in any server side scripting language, in your case you would be writing server code in .net
Now, your backend must expose a search api, Eg. If I send a HTTP GET with a variable q, it should return search results matching the query.
Your frontend must have input-box and a button for allowing users to send this request.
This answer isn't complete, just a vague overview of how this problem can be approached, also this isn't the only solution.

Best Practices: Website and Database Integration [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
What are the pros and cons of different methods of including data from a database on your webpage?
From my understanding I have two options. A html page, with JavaScript (or other browser language) that fetches and includes data. A php script (or other server based program) that builds and outputs an html page with the data already included. But how am I to made the decision between the two?
Always go for PHP when using a database. It is a more robust and proven technique.
Also PHP pages are protected by the server and nobody can see how the code works, they only see HTML output, whereas with Javascript anyone can see your code.
After all I don't know how JS supposed to interact with data, maybe store data in an XML page and then retrieve them, not sure. Why invent a wheel when you have PHP which is supposed to work with databases unlike JS which is designed mostly to be an improved front end functionality, unless its back end JS, but few people use JS that way.

Categories