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

Implementing Row Level Security on Einstein Analytics Datasets

Best Free Python Courses Online!

Tests for AWS CDK code

Searching and Sorting using Python

Best Programming Languages to learn in 2021!

Why you shouldn’t use the Else statement in your code

Kapten @ Android Makers || How we Internationalized our App

Java Projects With Source Code

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

Auto deploy Django projects on Heroku using GitHub repository

Uploading chunk files in Django class based view using Cloudinary

Creating a simple tic-tac-toe game with Django / Channels / DRF / Celery and Typescript.

Consume Rest API in Django Web Application