-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
34 lines (25 loc) · 745 Bytes
/
app.py
File metadata and controls
34 lines (25 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render
from django.urls import path
settings.configure(
DEBUG=True,
ROOT_URLCONF=__name__,
TEMPLATES=[
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": ["templates"],
},
],
)
def index_view(request):
return HttpResponse("<h1>Hello World From Django!</h1>")
def hello_view(request, name):
return render(request, "template.html", {"name": name})
urlpatterns = [
path("", index_view),
path("hello/<name>", hello_view),
]
if __name__ == "__main__":
from django.core.management import execute_from_command_line
execute_from_command_line()