Skip to content

Commit 69bd382

Browse files
5 - Home Page View including Settings Variables
1 parent 85357c0 commit 69bd382

File tree

11 files changed

+31
-0
lines changed

11 files changed

+31
-0
lines changed

pages/__init__.py

Whitespace-only changes.

pages/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

pages/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class PagesConfig(AppConfig):
5+
name = 'pages'

pages/migrations/__init__.py

Whitespace-only changes.

pages/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

pages/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

pages/views.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from django.conf import settings
2+
from django.http import HttpResponse
3+
from django.shortcuts import render
4+
5+
HOME_PAGE_MSG = getattr(settings, "HOME_PAGE_MSG", "Missing Message")
6+
7+
def home_view(request):
8+
return HttpResponse(f"<h1>{HOME_PAGE_MSG}</h1>")

serverless_django/settings/local.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from .installed import *
77

8+
9+
HOME_PAGE_MSG = "Hello World. This Is Local"
810
print("Using local")
911
# Database
1012
DATABASES = {

serverless_django/settings/local_proxy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from .installed import *
77

8+
HOME_PAGE_MSG = "Hello World. This Is a Local Proxy"
89
print("Using local proxy")
910
# Database
1011
DATABASES = {

serverless_django/settings/production.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
print("Using production")
1616
# Database
17+
18+
HOME_PAGE_MSG = "Hello World. This Is Production"
1719
DATABASES = {
1820
'default': {
1921
'ENGINE': 'django.db.backends.sqlite3',

serverless_django/urls.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
from django.contrib import admin
1717
from django.urls import path
1818

19+
# from pages import views as pages_views
20+
from pages.views import home_view
21+
1922
urlpatterns = [
23+
path('', home_view),
2024
path('admin/', admin.site.urls),
2125
]

0 commit comments

Comments
 (0)