The Python programming language was becoming increasingly popular in the development of web-based applications. In an attempt to leverage this and help speedily deploy secure and maintainable web applications, the Django web framework was developed.
The open-source web framework of Django, which is based entirely on Python, follows the model-view-template (MVT) architectural pattern. The framework focuses on reusing components created to help with rapid development. GIven that it is Python-based, the framework is highly portable and can run on any platform and has support for several client-side frameworks, templating engines, and databases.
Note: You will require Python to be installed to start with Django and will also require working knowledge of Python to execute the code.
Run the following command to create a the myproject directory in the current directory.
You can use the cd command on the command line interface to navigate to the required directory.
Create a template folder inside the myproject directory.
Inside the template folder, create another folder named static.
The view page contains the chart constructors, attributes as well as the datasource required to render the chart.
Add the code given below to the view.py file.
Add the following code snippet to the urls.py file, to automatically set the URL to render the chart.
To update the STATICFILES_DIRS object, include it in the settings.py file.
With all the code in place, it is now time to render the chart.
If you see any errors in your code, you can download the complete source code of the sample project we have created for this tutorial.
About the author: Software programmer, coffee snob, evangelist but a nerd by soul.