In this article, we will guide you through creating a language-learning application using Django in Python.
Language Learning App Using Django
Below, is the step-by-step Implementation of a language learning app using Django in Python:
Starting the Project Folder
To start the project use this command
django-admin startproject language_app
cd language_app
To start the app use this command
python manage.py startapp home
Now add this app to the ‘settings.py’
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"home",
]
File Structure
.png)
Setting Necessary Files
home/models.py: Below, models.py file defines Django models including UserProfile, Lesson, LessonTag, Language, UserLanguage, and CommunityPost. Each model encapsulates specific attributes and relationships for user profiles, lessons, tags, languages, user-language relations, and community posts. These models form the foundation for structuring data.
Python3
from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User,on_delete=models.CASCADE)
fullName = models.CharField(max_length=50, default="")
password = models.CharField(max_length=100,default="")
Email=models.EmailField(max_length=100)
language_level_choices = [
('beginner', 'Beginner'),
('intermediate', 'Intermediate'),
('advanced', 'Advanced'),
]
language_level = models.CharField(max_length=20, choices=language_level_choices)
# New fields for progress tracking and personalization
completed_lessons = models.ManyToManyField('Lesson', blank=True, related_name='completed_by_users')
favorite_language = models.ForeignKey('Language', null=True, blank=True, on_delete=models.SET_NULL)
def __str__(self):
return self.user.username
class Lesson(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
difficulty_choices = [
('easy', 'Easy'),
('medium', 'Medium'),
('hard', 'Hard'),
]
difficulty = models.CharField(max_length=20, choices=difficulty_choices)
created_at = models.DateTimeField(auto_now_add=True)
# New field for tags or categories
tags = models.ManyToManyField('LessonTag', blank=True)
def __str__(self):
return self.title
class LessonTag(models.Model):
name = models.CharField(max_length=50)
def __str__(self):
return self.name
class Language(models.Model):
name = models.CharField(max_length=50)
def __str__(self):
return self.name
class UserLanguage(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
language = models.ForeignKey(Language, on_delete=models.CASCADE)
def __str__(self):
return f"{self.user.username} - {self.language.name}"
class CommunityPost(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
title = models.CharField(max_length=100)
content = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
home/forms.py : Below, Django form file in the language_app directory defines Django forms such as SignUpForm, LoginForm, UserProfileForm, LessonForm, LanguageForm, FavoriteLanguageForm, and LessonTagForm. These forms are crucial for user authentication, user profiles, lesson creation, language selection, and lesson categorization.
Python3
from .models import LessonTag
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms
from django.db.models import fields
from .models import UserProfile, Lesson, Language, LessonTag, UserLanguage
class SignUpForm(UserCreationForm):
class Meta:
model = User
fields = ('username', 'password1', 'password2')
# language_app/forms.py
class LoginForm(AuthenticationForm):
# You can customize the form if needed (e.g., add extra fields, widgets, etc.)
class Meta:
model = User # Assuming User model is imported
fields = ['username', 'password']
class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = ['fullName', 'language_level',
'completed_lessons', 'favorite_language']
class LessonForm(forms.ModelForm):
class Meta:
model = Lesson
fields = ['title', 'content', 'difficulty', 'tags']
title = forms.CharField(widget=forms.TextInput(
attrs={'placeholder': 'Enter the lesson title'}))
content = forms.CharField(widget=forms.Textarea(
attrs={'placeholder': 'Enter the lesson content'}))
difficulty = forms.ChoiceField(choices=Lesson.difficulty_choices)
tags = forms.ModelMultipleChoiceField(
queryset=LessonTag.objects.all(), widget=forms.CheckboxSelectMultiple)
class LanguageForm(forms.ModelForm):
class Meta:
model = UserLanguage
fields = ['language', 'user']
class FavoriteLanguageForm(forms.ModelForm):
class Meta:
model = Language
fields = ['name']
class LessonTagForm(forms.ModelForm):
class Meta:
model = LessonTag
fields = ['name']
name = forms.CharField(widget=forms.TextInput(
attrs={'placeholder': 'Enter tag name'}))
home/views.py : Below code contains Django views for index, dashboard, community_posts, update_profile, create_lesson, create_community_post, login, signup, logout, lesson_detail, create_lesson_tag, language, and select_favorite_language. These views manage user authentication, profile, lesson creation, community posts, language selection, and lesson tagging.
Python3
from .forms import FavoriteLanguageForm
from .forms import LessonForm
from .forms import UserProfileForm
from django.contrib import auth, messages
from django.shortcuts import render
from .models import UserProfile, Lesson, Language, UserLanguage, CommunityPost
from django.contrib.auth.views import LoginView
from .models import Lesson
from .forms import FavoriteLanguageForm, LessonTagForm, LanguageForm
from django.shortcuts import render, redirect
from django.contrib.auth import login as auth_login
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.shortcuts import render, get_object_or_404
from django.contrib.auth import login, authenticate
from django.shortcuts import render, redirect
from .forms import SignUpForm
from django.contrib import messages
from django.contrib.auth.models import User
from django.contrib import auth
from .models import UserProfile
from django.urls import reverse
def index(request):
return render(request, 'index.html')
def dashboard(request):
user_profile = UserProfile.objects.get(user=request.user)
user_languages = UserLanguage.objects.filter(user=request.user)
community_posts = CommunityPost.objects.all()
# Fetch completed lessons and favorite language
completed_lessons = user_profile.completed_lessons.all()
favorite_language = user_profile.favorite_language
context = {
'user_profile': user_profile,
'user_languages': user_languages,
'community_posts': community_posts,
'completed_lessons': completed_lessons,
'favorite_language': favorite_language,
}
return render(request, 'dashboard.html', context)
def community_posts(request):
posts = CommunityPost.objects.all()
return render(request, 'community_posts.html', {'posts': posts})
def update_profile(request):
user_profile = UserProfile.objects.get(user=request.user)
if request.method == 'POST':
form = UserProfileForm(request.POST, instance=user_profile)
if form.is_valid():
form.save()
# Redirect to the index page after successful form submission
return redirect('index')
else:
form = UserProfileForm(instance=user_profile)
context = {
'form': form,
}
return render(request, 'update_profile.html', context)
def create_lesson(request):
if request.method == 'POST':
form = LessonForm(request.POST)
if form.is_valid():
lesson = form.save()
# Redirect to the lesson detail page after successful form submission
return redirect('update_profile')
else:
form = LessonForm()
context = {
'form': form,
}
return render(request, 'create_lesson.html', context)
def create_community_post(request):
if request.method == 'POST':
title = request.POST['title']
content = request.POST['content']
user = request.user
CommunityPost.objects.create(user=user, title=title, content=content)
return redirect('community_posts')
return render(request, 'create_community_post.html')
def index(request):
return render(request, "index.html")
def login(request):
if request.method == "POST":
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(username=username, password=password)
if user is not None:
auth.login(request, user)
return render(request, 'dashboard.html')
else:
messages.info(request, "successfully")
# data=user.objects.all()
# return render(request,'home.html',{'da':data})
return render(request, 'login.html')
else:
return render(request, "login.html")
def logout(request):
auth.logout(request)
messages.success(request, "logout succesfully")
return render(request, "index.html")
def login(request):
if request.method == 'POST':
user = auth.authenticate(
username=request.POST['username'], password=request.POST['password'])
if user is not None:
user_profile = UserProfile.objects.get(user=user)
auth.login(request, user)
return redirect('dashboard')
else:
messages.error(request, 'Invalid credentials')
return redirect('login')
return render(request, 'login.html')
def signup(request):
"""
signup user
input: user_type,user_name,password,phone number
"""
if request.method == 'POST':
if request.POST['password1'] == request.POST['password2']:
try:
user = User.objects.get(username=request.POST['username'])
if user:
messages.error(request, 'Username already exists!')
return render(request, 'signup.html')
except User.DoesNotExist:
user = User.objects.create_user(
request.POST['username'], password=request.POST['password1'],
first_name=request.POST['name'],
email=request.POST['email'])
auth.login(request, user)
user_profile = UserProfile.objects.create(
user=request.user)
user_profile.fullName = request.POST['name']
user_profile.Email = request.POST['email']
print(request.FILES)
user_profile.save()
return redirect('dashboard')
else:
messages.error(request, 'Passwords should match')
return render(request, 'signup.html')
return render(request, 'signup.html')
def logout(request):
"""
logout user
"""
if request.method == "POST":
auth.logout(request)
return render(request, 'login.html')
auth.logout(request)
return render(request, 'login.html')
def lesson_detail(request, lesson_id):
lesson = get_object_or_404(Lesson, pk=lesson_id)
# Track user progress
user_profile = UserProfile.objects.get(user=request.user)
user_profile.completed_lessons.add(lesson)
return render(request, 'lesson_detail.html', {'lesson': lesson})
def create_lesson_tag(request):
if request.method == 'POST':
form = LessonTagForm(request.POST)
if form.is_valid():
lesson_tag = form.save()
# Redirect to the lesson_tags page after successful form submission
return redirect('create_lesson')
else:
form = LessonTagForm()
context = {
'form': form,
}
return render(request, 'create_lesson_tag.html', context)
def language(request):
if request.method == 'POST':
form = LanguageForm(request.POST)
if form.is_valid():
language = form.save()
# Redirect to the lesson_tags page after successful form submission
return redirect('dashboard')
else:
form = LanguageForm()
context = {
'form': form,
}
return render(request, 'language.html', context)
def select_favorite_language(request):
if request.method == 'POST':
form = FavoriteLanguageForm(request.POST)
if form.is_valid():
user_language = form.save(commit=False)
user_language.user = request.user
user_language.save()
# Redirect to the index page after successful form submission
return redirect('index')
else:
form = FavoriteLanguageForm()
context = {
'form': form,
}
return render(request, 'select_favorite_language.html', context)
Creating GUI
templates/create_community_post : This HTML template renders a form to create a new community post in the Language Learning App. It includes fields for the post title and content, with validation to ensure they are required.
HTML
<!-- language_app/templates/create_community_post.html -->
{% extends 'base.html' %}
{% block title %}Create Community Post - Language Learning App{% endblock %}
{% block content %}
<section class="container my-4">
<h2>Create a New Community Post</h2>
<form method="post" action="{% url 'create_community_post' %}">
{% csrf_token %}
<label for="title">Title:</label>
<input type="text" name="title" required>
<label for="content">Content:</label>
<textarea name="content" required></textarea>
<button type="submit">Submit</button>
</form>
</section>
{% endblock %}
templates/community_posts : This HTML template displays a list of community posts in the Language Learning App. It iterates over the 'posts' variable to render each post's title, content, author, and creation date. Additionally, it includes a link to create a new post.
HTML
<!-- language_app/templates/community_posts.html -->
{% extends 'base.html' %}
{% block title %}Community Posts - Language Learning App{% endblock %}
{% block content %}
<section class="container my-4">
<h2>Community Posts</h2>
<ul>
{% for post in posts %}
<li>
<strong>{{ post.title }}</strong>
<p>{{ post.content }}</p>
<p>Posted by {{ post.user.username }} on {{ post.created_at }}</p>
</li>
{% endfor %}
</ul>
<a href="{% url 'create_community_post' %}">Create a New Post</a>
</section>
{% endblock %}
templates/signup.html : This HTML template presents a sign-up form for users to register in the Language Learning App. It includes fields for username, name, email, password, and password confirmation. Upon submission, the form data is sent to the 'signup' URL for processing.
HTML
<!-- language_app/templates/signup.html -->
{% extends 'base.html' %}
{% block title %}Sign Up - Language Learning App{% endblock %}
{% block content %}
<section class="container my-4">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Sign Up</h4>
</div>
<div class="card-body">
<form method="post" action="{% url 'signup' %}" enctype="multipart/form-data">
{% csrf_token %}
<h2 class="text-center">Sign Up</h2>
<div class="form-group">
<label for="username">User Name</label>
<input type="text" class="form-control" id="username" aria-describedby="emailHelp" name="username">
</div>
<div class="form-group">
<label for="username">Name</label>
<input type="text" class="form-control" id="name" aria-describedby="emailHelp" name="name">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" aria-describedby="emailHelp" name="email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" name="password1">
</div>
<div class="form-group">
<label for="exampleInputPassword2"> Confirm Password</label>
<input type="password" name="password2" class="form-control" id="exampleInputPassword2">
</div>
<div class="form-group">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
templates/login.html : This HTML template presents a login form for users to log in to the Language Learning App. It includes fields for username and password. Upon submission, the form data is sent to the 'login' URL for processing.
HTML
<!-- language_app/templates/login.html -->
{% extends 'base.html' %}
{% block title %}Log In - Language Learning App{% endblock %}
{% block content %}
<section class="container my-4">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Log In</h4>
</div>
<div class="card-body">
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<div class="form-group">
<div class="input-group">
<i class="fas fa-user mx-2 my-auto"></i>
<input type="text" class="form-control" name="username" placeholder="Username" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<i class="fas fa-key mx-2 my-auto"></i>
<input type="password" class="form-control" name="password" placeholder="Password" />
</div>
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-success">Login</button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
templates/index.html : This HTML template serves as the homepage for the Language Learning App, presenting information about the app and providing options for users to sign up, log in, or log out. It also highlights the app's features and includes a footer with the app's copyright information.
HTML
<!-- language_app/templates/index.html -->
{% extends 'base.html' %}
{% block title %}Welcome to the Language Learning App{% endblock %}
{% block content %}
<section class="hero text-center">
<h2>Welcome to the Language Learning App</h2>
</section>
<section class="getting-started text-center my-4">
<h2>Getting Started</h2>
<ul class="list-unstyled">
<li><a class="btn btn-primary" href="{% url 'signup' %}">Sign Up</a></li><br>
<li><a class="btn btn-outline-primary" href="{% url 'login' %}">Log In</a></li>
<li><a class="btn btn-outline-primary" href="{% url 'logout' %}">Log out</a></li>
</ul>
</section>
<section class="features my-4">
<h2 class="text-center">Features</h2>
<ul class="list-group">
<li class="list-group-item">Interactive Lessons</li>
<li class="list-group-item">User Profiles and Progress Tracking</li>
<li class="list-group-item">Community Interaction and Language Exchange</li>
</ul>
</section>
<footer class="bg-dark text-white text-center py-3">
<p>© 2024 Language Learning App</p>
</footer>
{% endblock %}
templates/base.html : This HTML template serves as the base layout for all pages in the Language Learning App. It includes a header with navigation links, a main content area where specific page content will be inserted using blocks, and necessary scripts for Bootstrap and jQuery.
HTML
<!-- language_app/templates/base.html -->
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Language Learning App{% endblock %}</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="{% static 'styles.css' %}">
</head>
<body>
<header class="bg-dark text-white text-center py-4">
<h1>{% block header %}Language Learning App{% endblock %}</h1>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<ul class="navbar-nav mx-auto">
<li class="nav-item"><a class="nav-link" href="{% url 'index' %}">Home</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'signup' %}">Sign Up</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'login' %}">Log In</a></li>
</ul>
</nav>
</header>
<main class="container my-4">
{% block content %}{% endblock %}
</main>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</body>
</html>
templates/dashboard.html : This HTML template represents the dashboard of the Language Learning App, displaying user profile information, language progress, community interaction options, and recent community posts. Users can see their completed lessons, favorite language, and access various community-related features.
HTML
<!-- language_app/templates/dashboard.html -->
{% extends 'base.html' %}
{% block title %}Dashboard - Language Learning App{% endblock %}
{% block content %}
<section class="container my-4">
<div class="row">
<div class="col-md-8">
<div class="card">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">User Profile</h4>
</div>
<div class="card-body">
<p><strong>Username:</strong> {{ user_profile.user.username }}</p>
<p><strong>Email:</strong> {{ user_profile.user.email }}</p>
<p><strong>Language Level:</strong> {{ user_profile.language_level }}</p>
</div>
</div>
<div class="card mt-4">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Your Languages</h4>
</div>
<div class="card-body">
<ul>
{% for user_language in user_languages %}
<li>{{ user_language.language.name }}</li>
{% endfor %}
</ul>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card mt-4">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Your Progress</h4>
</div>
<div class="card-body">
<h5>Completed Lessons:</h5>
<ul>
{% for lesson in completed_lessons %}
<li>{{ lesson.title }}</li>
{% endfor %}
</ul>
<!-- language_app/templates/dashboard.html -->
<h5 >lesson_detail:</h5>
<ul>
{% for lesson in completed_lessons %}
<li>
<a href="{% url 'lesson_detail' lesson_id=lesson.id %}">{{ lesson.title }}</a>
{% comment %} <a href="{% url 'lesson_detail' %}">{{ lesson.title }}</a> {% endcomment %}
</li>
{% endfor %}
</ul>
<h5>Favorite Language:</h5>
<p>{{ favorite_language.name }}</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Community Interaction</h4>
</div>
<div class="card-body">
<ul>
<li><a href="{% url 'update_profile' %}">Create your profile</a></li>
<li><a href="{% url 'community_posts' %}">Community Posts</a></li>
<li><a href="{% url 'create_community_post' %}">Create a Community Post</a></li>
<li><a href="{% url 'language' %}">your language</a></li>
<li><a href="{% url 'select_favorite_language' %}">Select Favorite Language</a></li>
<li><a href="{% url 'create_lesson' %}">Create Lesson</a></li>
</ul>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Community Posts</h4>
</div>
<div class="card-body">
{% for post in community_posts %}
<div class="mb-3">
<h5>{{ post.title }}</h5>
<p>{{ post.content }}</p>
<small class="text-muted">Posted by {{ post.user.username }} on {{ post.created_at }}</small>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</section>
{% endblock %}
templates/create_lesson_tag.html : This HTML template is used to create a new lesson tag in the Language Learning App. It includes a form where users can input the details of the tag, such as the name, and submit the form to create the tag.
HTML
{% extends 'base.html' %}
{% block content %}
<h2>Create Lesson Tag</h2>
<form method="post" action="{% url 'create_lesson_tag' %}">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Create Tag">
</form>
{% endblock %}
templates/select_favorite_language.html : This HTML template is used to allow users to select their favorite language in the Language Learning App. It includes a form where users can choose their preferred language from a dropdown menu or other input fields, and then submit the form.
HTML
{% extends 'base.html' %}
{% block content %}
<h2>Select Your Favorite Language</h2>
<form method="post" action="{% url 'select_favorite_language' %}">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Select Favorite Language">
</form>
{% endblock %}
templates/language.html : This HTML template allows users to select their preferred language in the Language Learning App. It presents a form where users can choose their language from a list or other input options and submit the form to save their selection.
HTML
{% extends 'base.html' %}
{% block content %}
<h2>Select Your Language</h2>
<form method="post" action="{% url 'language' %}">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Select Language">
</form>
{% endblock %}
templates/update_profile.html : This HTML template is used to create or update a user's profile in the Language Learning App. It provides a form where users can input their profile information and submit the form to save or update their profile details
HTML
{% extends 'base.html' %}
{% block title %}Create Your Profile - Language Learning App{% endblock %}
{% block content %}
<section class="container my-4">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Create Your Profile </h4>
</div>
<div class="card-body">
<form method="post" action="{% url 'update_profile' %}">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Update Profile">
</form>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
templates/lesson_detail.html : This HTML template displays the details of a lesson in the Language Learning App. It shows the lesson's title and content within a card. Users can view the lesson content and interact with any associated functionality provided by the app.
HTML
{% extends 'base.html' %}
{% block title %}{{ lesson.title }} - Language Learning App{% endblock %}
{% block content %}
<section class="container my-4">
<div class="card">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">{{ lesson.title }}</h4>
</div>
<div class="card-body">
<p>{{ lesson.content }}</p>
</div>
</div>
</section>
<li><a href="{% url 'select_favorite_language' %}">Select Favorite Language</a></li>
{% endblock %}
home/urls.py : This urlpatterns
list defines paths for the Django project: admin/
for the admin interface and ''
for URLs defined in the "home" app
Python3
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include("home.urls")),
]
learning_app/urls.py : These urlpatterns in Django project correspond to views.
Python3
from django.urls import path
from .import views
urlpatterns = [
path('', views.index, name="index"),
path('signup', views.signup, name='signup'),
path('login/', views.login, name='login'),
path('logout/', views.logout, name='logout'),
path('dashboard/', views.dashboard, name='dashboard'),
path('UserProfile/', views.UserProfile, name='Userprofile'),
path('lesson/<int:lesson_id>/', views.lesson_detail, name='lesson_detail'),
path('community/', views.community_posts, name='community_posts'),
path('community/create/', views.create_community_post,
name='create_community_post'),
path('update-profile/', views.update_profile, name='update_profile'),
path('create_lesson/', views.create_lesson, name='create_lesson'),
path('select_favorite_language/', views.select_favorite_language,
name='select_favorite_language'),
path('create_lesson_tag/', views.create_lesson_tag, name='create_lesson_tag'),
path('language/', views.language, name='language'),
]
admin.py: Here we are registering our models.
Python3
from django.contrib import admin
from .models import *
admin.site.register(Lesson)
admin.site.register(UserProfile)
admin.site.register(LessonTag)
admin.site.register(Language)
admin.site.register(UserLanguage)
admin.site.register(CommunityPost)
Deployement of the Project
Run these commands to apply the migrations:
python3 manage.py makemigrations
python3 manage.py migrate
Create the superuser using the below command :
python3 manage.py createsuperuser
Run the server with the help of following command:
python3 manage.py runserver
Output:
.png)
Output
Similar Reads
Note-taking App using Django
In this article, we will explore a note-making app. In this article, we will create a note-making app using Django. We will also use the Django authentication system. Users need to create an account on the web to access the note-making app. After that, users will have access to the note-making app.
8 min read
Translator App Project using Django
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. R
2 min read
E-book Library using Django
In this article, we will demonstrate how to build an E-book Library using Django. We have incorporated the functionality of login and registration, ensuring that users must first log in and register to access and read books. Additionally, after logging in, users gain the capability to both read and
15+ min read
Image Gallery GUI using Django
Django, a powerful web framework for Python, makes it relatively easy to create a robust and user-friendly Image Gallery Graphical User Interface (GUI) for your web application. In this article, we'll guide you through the process of building an Image Gallery GUI using Django. Image Gallery GUI usin
4 min read
Music Player using Django
In this article, we'll build a Music Player using Django. To get started, the first thing we'll do is create an account, just like with other music players. After creating the account, we'll log in. Once successfully logged in, we'll be redirected to the home page. On the home page, we can search fo
13 min read
Recipe Meal Planner using Django
In this article, we will create the Recipe Meal Planner using Django step-by-step. Generally, we will implement the CRUD (Create, Read, Update, Delete) operations, allowing users to add the recipe name, day, and the recipe itself. Additionally, we will establish a login system, requiring users to re
9 min read
A Guide to Sending Data Using Cache in Django
In this article, we aim to comprehensively explore the functionality of sending data using cache in Django by providing a well-structured example implementation. Through this practical demonstration, we will delve into the intricacies of Django's caching system, ensuring that you gain a clear unders
6 min read
Quiz Application using Django
In this article, we will create the Django Quiz Application generally the Django Quiz App is a versatile and interactive web application designed to revolutionize learning and assessment. Created to address the need for engaging and adaptable online quizzes, it offers educators, businesses, and indi
6 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 wit
3 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 creat
2 min read