Django Meme App

Nilay Paul
2 min readApr 28, 2021

Today we will see how to create a meme app in django.

It’s a pretty basic build and a good companion of weather app using weather Api.

We will use “” this end point.

django-admin startproject MEME
python startapp mymeme

Create a templates folder inside the project.

Project structure
In the installed app list of of the project add ‘mymeme’ app and in the DIRS[] add ‘templates’

In the project level add

from django.contrib import adminfrom django.urls import path,includeurlpatterns = [path('admin/',,path('',include('mymeme.urls'))]

In the app level use add..

from django.urls import path,includefrom . import viewsurlpatterns = [path('',views.getdata,name="getdata")]

In the of the app add

from django.shortcuts import renderimport requests# Create your views here.def getdata(request):        response=requests.get('').json()        context={              'url':response['url']        }        return render(request,'index.html',context)

In the index.html file add

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Meme App</title><style>.container{display: flex;justify-content: center;}</style></head><body><div class="container"><img src="{{ url }}" alt="Your internet connection may be broken!" style="width: 30%;height:30%;padding:15px;"></div><div class="container"><button style="background-color: aqua;padding:10px;margin:15px;border-radius:5px;cursor:pointer;" onclick="location.href='{% url 'getdata' %}'">Press To Load More</button></div></body></html>

Now run “Python runserver” command.

And that’s basically it.


Deployed version ->