Skip to content

Commit 358697c

Browse files
committed
Refactored a little bit of Chapter 02
1 parent 9529a15 commit 358697c

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Diff for: chapter02/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
2. views.homepage (correspond to ```views.py```)
4141
3. name="home" (it's ?optional) (access by ***URL/?name***)
4242

43+
### temp-notes
44+
- newapp:
45+
- -> setting -> app-folder
46+
- -> proj_url -> app_url -> app_view -> model (& db)
4347

4448
### conventions
4549
- I found the ```urlpatterns``` in ```urls.py``` is ?required by *Django*

Diff for: chapter02/hey_world/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
'django.contrib.sessions',
3838
'django.contrib.messages',
3939
'django.contrib.staticfiles',
40-
'pages',
40+
'pages.apps.PagesConfig', # FOLDER.FILE.CLASS
4141
]
4242

4343
MIDDLEWARE = [

Diff for: chapter02/pages/urls.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from django.urls import path
22

3-
from . import views
3+
from .views import Homepage
44

55

66
urlpatterns = [
7-
path("", views.homepage, name="home"),
7+
path("", Homepage, name="home"),
88
]

Diff for: chapter02/pages/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Create your views here.
44

55

6-
def homepage(request):
6+
def Homepage(request):
77
return HttpResponse("Hey django")

0 commit comments

Comments
 (0)