Django Meme App

django-admin startproject MEME
python startapp mymeme
Project structure
In the installed app list of of the project add ‘mymeme’ app and in the DIRS[] add ‘templates’
from django.contrib import adminfrom django.urls import path,includeurlpatterns = [path('admin/',,path('',include('mymeme.urls'))]
from django.urls import path,includefrom . import viewsurlpatterns = [path('',views.getdata,name="getdata")]
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)
<!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>




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Google Plays Ignorance: Not only was my App suspended, but my idea (work) was crushed

Udacity Project Completion Challenge #3 -Chasing The Deadline

What is ZEXE? (Part III)

What is CI/CD? Where can I use it?

Easy way to implement User Session-Timeout feature in Flutter

Google Code-In  — A competition for teenage geeks

Should you use Leetcode?

7 Tips You Should Follow While Doing Personal Side Projects

Image of plant growing in a window

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nilay Paul

Nilay Paul

More from Medium

WSGI Protocol and Django Implementation

How to set up a Project in Django

List as a parameters in “GET” request : Django

Setting Up Django App