-
Notifications
You must be signed in to change notification settings - Fork 0
/
Learn Django
33 lines (29 loc) · 858 Bytes
/
Learn Django
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
pip3 install Django
apt-get install python3
django-admin startproject helloapp
python3
manage.py startapp howdy
/root/Desktop/django/helloapp/helloapp/settings.py
On MiddleWare->type 'howdy'
python3 manage.py runserver
On helloapp/helloapp/settings.py
#from django.urls import path
#path('admin/', admin.site.urls),
url(r'^admin/',admin.site.urls),
url(r'^',include('howdy.urls')),
On helloapp/howdy
from django.conf.urls import url
from howdy import views
urlpatterns = [
url(r'^$/',views.HomePageView.as_view()),
]
Helloapp ->
--> Howdy->
Urls (Homepage) --> View(HTML)
On helloapp/howdy/views.py
from django.shortcuts import render
from django.views.generic import TemplateView
# Create your views here
class HomePageView(TemplateView):
def get(self,request, **kwargs):
return render(request,'index.html',context=None)