from django.shortcuts import render
from django.http import HttpResponse
def home(request):
return HttpResponse("<h1>A simple views!</h1>")
Setting up our urls
first we have to configure our urls.py in our project folder
project/urls.py
from django.contrib import admin
from django.urls import path, include # so we can include our app urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('app.urls')), #here
]
Then
app/urls.py
from django.urls import path
from . import views # importing the view
urlpatterns = [
path('', views.home, name="home"),
]
A simple view and url config
We will Look at templates and static directory/files in the next tutorial