Open In App

Translator App Project using Django

Last Updated : 16 Mar, 2021
Like Article

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

Refer to the following articles to check how to create a project and an app in Django.

In this article we will make a translator app using Django.


pip install django

Text translation from one language to another is increasingly becoming common for various websites as they cater to an international audience. The python package which helps us do this is called translate.

pip install translate

Then create new project

django-admin startproject translator
cd translator

Then create new app inside the project

python startapp main

Then add the app name inside the


from django.shortcuts import render,HttpResponse
from translate import Translator
# Create your views here.
def home(request):
    if request.method == "POST":
        text = request.POST["translate"]
        language = request.POST["language"]
        translator= Translator(to_lang=language)
        translation = translator.translate(text)
        return HttpResponse(translation)
    return render(request,"main/index.html")

Then create directory templates inside the app.

Inside that create new directory main

Create new file index.html


<!DOCTYPE html>
<form method="post">
    {% csrf_token %}
    <input type="text" name="translate" required>
    <select required name="language">
        <option value="Hindi">Hindi</option>
        <option value="Marathi">Marathi</option>
        <option value="German">German</option>
    <button type="submit">Translate</button>

Then create new file inside the app


from django.urls import path
from .views import *
urlpatterns = [

Then add then main.urls inside url translator/


from django.contrib import admin
from django.urls import path,include
urlpatterns = [

To run this app open cmd or terminal 

python runserver

Output :-

Similar Reads

Adding Tags Using Django-Taggit in Django Project
Django-Taggit is a Django application which is used to add tags to blogs, articles etc. It makes very easy for us to make adding the tags functionality to our django project.Setting up Django Project Installing django-taggit pip install django-taggitADD it to Main Project's file C/C++ Code INSTALLED_APPS = [ 'django.contrib.admin', 'dja
2 min read
Wikipedia search app Project using Django
Django is a high-level Python based Web Framework that allows rapid development and clean, pragmatic design. It is also called batteries included framework because Django provides built-in features for everything including Django Admin Interface, default database – SQLlite3, etc. Today we will create joke app in django. In this article we will make
2 min read
Language Translator Using Google API in Python
API stands for Application Programming Interface. It acts as an intermediate between two applications or software. In simple terms, API acts as a messenger that takes your request to destinations and then brings back its response for you. Google API is developed by Google to allow communications with their servers and use their API keys to develop
4 min read
Python - Morse Code Translator GUI using Tkinter
Prerequisites : Introduction to tkinter | Morse Code Translator Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter outputs the fastest and easiest way to create GUI applications. In this article, we will learn how to create a Morse
6 min read
Create a real time voice translator using Python
In this article, we are going to create a real-time voice translator in Python. Module neededplaysound: This module is used to play sound in Pythonpip install playsoundSpeech Recognition Module: It is a library with the help of which Python can recognize the command given. We have to use pip for Speech Recognition.pip install SpeechRecognitiongoogl
7 min read
Morse Code Translator In Python
Morse code is a method of transmitting text information as a series of on-off tones, lights, or clicks that can be directly understood by a skilled listener or observer without special equipment. It is named for Samuel F. B. Morse, an inventor of the telegraph. Algorithm The algorithm is very simple. Every character in the English language is subst
5 min read
How to customize Django forms using Django Widget Tweaks ?
Django forms are a great feature to create usable forms with just few lines of code. But Django doesn't easily let us edit the form for good designs. Here, we will see one of the ways to customize Django forms, So they will look according to our wish on our HTML page. Basically we will check the methods to include our own custom css, classes, or id
3 min read
Integrating Django with Reactjs using Django REST Framework
In this article, we will learn the process of communicating between the Django Backend and React js frontend using the Django REST Framework. For the sake of a better understanding of the concept, we will be building a Simple Task Manager and go through the primary concepts for this type of integration between React js and Django. Reactjs in a nuts
18 min read
How to Create a Basic Project using MVT in Django ?
Prerequisite - Django Project MVT Structure Assuming you have gone through the previous article. This article focuses on creating a basic project to render a template using MVT architecture. We will use MVT (Models, Views, Templates) to render data to a local server. Create a basic Project: To initiate a project of Django on Your PC, open Terminal
2 min read
How to create a new project in Django using Firebase Database?
Django is a Python-based web framework that allows you to quickly create efficient web applications. If you are new to Django then you can refer to Django Introduction and Installation. Here we are going to learn How to create a Django project using Firebase as Database . How to create a new project in Firebase ? Step 1: Firstly, We are going to Cr
3 min read