Single and Multiple Files Upload Example in Django REST API

Most of the applications require at least one file needs to be upload for a reason, such as, for uploading bulk data or processing file data for business requirement. This example will show you how to upload single or multiple files using Django REST framework. REST is an acronym that stands for Representation State Transfer which works on http/https protocol. It is light weight and delivers data very fast. I am assuming you have a basic knowledge on Python and Django REST framework before you proceed further down. I am…

Continue

Single or Multiple Files Upload Example in Django Framework

In your application or project there is always a requirement for uploading a file data. This file data could be in a specific format depending on your requirement. Here I am going to explain you how you can upload single or multiple files in your python based Django framework. I am assuming you have a basic knowledge on Python and Django framework before you proceed further. I am also going to show you how to implement CSRF token for uploading files.

Continue

Docker Compose – Dockerizing Django MySQL App

In this tutorial I will show you how to dockerize Django MySQL app using docker compose in Linux environment. So why do you need docker compose when you have docker container? Generally it is said to be best practices when each docker container runs a process with single responsibility, but for this application you need two containers – one is for Django app and another one is for MySQL server. Therefore two containers are running independently and to establish communication between two containers you need docker compose.

Continue

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 elements using a 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…

Continue

Working with media files in Django templates

Introduction This tutorial will show you working with media files in Python based Django templates. Media files, such as, images, videos etc. are frequently loaded into your 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