repl.it
@CKaps1/

Basic Template

Django

Simple first steps to learn Django

fork
loading
Files
  • main
    • views.py
    • __pycache__
    • migrations
    • models.py
    • settings.py
    • urls.py
  • db.sqlite3
main/views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 #First line is there from template
from django.shortcuts import render
 #Used to return proper html format -- imports HttpResponse
from django.http import HttpResponse
from django.views.generic import TemplateView

#Creating our view of homepage as a function --request carries info about the page
def homePageView(request):
  html = "Hello, World!" 
  return HttpResponse(html)
  #This is where we return the html in a form django can understand

#Django doesn't know where to display the view - head to URL's