How to use Swagger with Python based Django REST APIs

Here in this tutorial I am going to show you how to use Swagger API with Django REST framework. Swagger API provides well structured documentation for REST API endpoints so a new person can say how to test a REST API without knowing its internal implementation. Essentially, Swagger does a simple but very powerful thing: with a bit of additional annotations it generates the REST API descriptions such as HTTP methods, path / query / form parameters, responses, HTTP error codes etc) and even provides a simple web UI to…

Continue

How to setup Python based Django framework and MySQL Databse to execute SQL statements

Introduction Here in this tutorial I am going to show you how to setup Python based Django framework and MySQL database server to execute SQL statement in Windows environment. The MySQL server is used as a persistent system for storing data for the application. I have already discussed in my another tutorial how to setup Django, so I won’t repeat the same thing here. As a prerequisite you need to go through the django setup tutorial before going down further.

Continue

How to setup Python based Django framework in Windows

Introduction In this example I am going to show you how to configure Python based Django in Windows Operating System. The current version of Django, at the time of writing, I am using here is 3.0.8. Here I am going to show you how to install latest version of Django in Windows 64 bit Operating System. I am also going to create a sample project to test the configuration whether it works successfully or not. The development server comes as a built-in server with Django framework and it should not…

Continue

How to create Photo Gallery with Django

Introduction Here I will show you how to create photo gallery with Django. Django is a Python based framework used to build complete web applications. Photo gallery also known as image gallery, media gallery or photo album is used to manage your photos. You can view the images one by one from a list of images in a gallery. You can navigate to another photo in the gallery using next or previous arrow link. You can click on a particular photo to see the larger size of the thumbnail which…

Continue

Creating custom template tags and filter in Django

Introduction Creating custom tags and filter in Django templates is pretty simple. It acts like a custom function that can be used in Django templates. The situation may occur where you need to split a string or you need to access array element using variable as an index, then you have to create custom tags and filter (acts as a function) in Django templates. You will find that built-in function, such as, split() is there in Python but you won’t be able to use this function directly in Django template.…

Continue

Working with media files in Django templates

Introduction In this tutorial we will see working with media files in Django templates. Media files, such as, images, videos etc. are frequently loaded into our web application as these files improve end users’ experience. Note that static resources or files and media files are two different things. Media files are generally uploaded by users for explaining a certain event. You may also like to read working with static resources in Django templates.

Continue

Working with static resources in Django templates

Introduction In this tutorial we will see working with static resources in Django templates. Static resources, such as, css (Cascading Style Sheet), images, js (JavaScript) are frequently required to include in our web application as these resources increase look and feel and to handle any events of the web pages. Django provides django.contrib.staticfiles to help you manage them. You may like to read on template.

Continue

Working with parent and child templates in Django

Introduction Here we will see working with template inheritance in Django or on other words, working with parent and child templates in Django. Being a web framework, Django needs a convenient way to generate HTML dynamically. The most common approach relies on templates. A template contains the static parts of the desired HTML output as well as some special syntax describing how dynamic content will be inserted. A template is simply a text file. It can generate any text-based format (HTML, XML, CSV, etc.). A template contains variables, which get…

Continue