From f44f1061a6f32eaa5dd1a42742f92e776641e97f Mon Sep 17 00:00:00 2001 From: Bobby Date: Wed, 20 Jul 2022 06:18:14 +0530 Subject: Basic Hello World page with Debug Disabled --- blog/__init__.py | 0 blog/admin.py | 3 +++ blog/apps.py | 6 ++++++ blog/migrations/__init__.py | 0 blog/models.py | 3 +++ blog/templates/home.html | 3 +++ blog/tests.py | 3 +++ blog/urls.py | 6 ++++++ blog/views.py | 6 ++++++ thatcomputerscientist/settings.py | 3 ++- thatcomputerscientist/urls.py | 3 ++- 11 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 blog/__init__.py create mode 100644 blog/admin.py create mode 100644 blog/apps.py create mode 100644 blog/migrations/__init__.py create mode 100644 blog/models.py create mode 100644 blog/templates/home.html create mode 100644 blog/tests.py create mode 100644 blog/urls.py create mode 100644 blog/views.py diff --git a/blog/__init__.py b/blog/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/blog/admin.py b/blog/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/blog/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/blog/apps.py b/blog/apps.py new file mode 100644 index 00000000..94788a5e --- /dev/null +++ b/blog/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class BlogConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'blog' diff --git a/blog/migrations/__init__.py b/blog/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/blog/models.py b/blog/models.py new file mode 100644 index 00000000..71a83623 --- /dev/null +++ b/blog/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/blog/templates/home.html b/blog/templates/home.html new file mode 100644 index 00000000..7f246ce9 --- /dev/null +++ b/blog/templates/home.html @@ -0,0 +1,3 @@ +

Hello, world!

+
+

This website is under construction and will be available soon.

\ No newline at end of file diff --git a/blog/tests.py b/blog/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/blog/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/blog/urls.py b/blog/urls.py new file mode 100644 index 00000000..9ec83613 --- /dev/null +++ b/blog/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.home, name='home'), +] diff --git a/blog/views.py b/blog/views.py new file mode 100644 index 00000000..699940a6 --- /dev/null +++ b/blog/views.py @@ -0,0 +1,6 @@ +from django.shortcuts import render + +# Create your views here. + +def home(request): + return render(request, 'home.html', {'title': 'Home'}) diff --git a/thatcomputerscientist/settings.py b/thatcomputerscientist/settings.py index f68c4e36..715a52b2 100644 --- a/thatcomputerscientist/settings.py +++ b/thatcomputerscientist/settings.py @@ -27,7 +27,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = os.getenv('AUTHORIZATION_STRING') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = os.getenv('ENVIRONMENT') == 'development' or False ALLOWED_HOSTS = ["*"] CSRF_TRUSTED_ORIGINS = ['https://*.thatcomputerscientist.com', 'https://*.thatcomputerscientist.fly.dev/'] @@ -43,6 +43,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'blog', ] MIDDLEWARE = [ diff --git a/thatcomputerscientist/urls.py b/thatcomputerscientist/urls.py index f7e33978..2fb02d7d 100644 --- a/thatcomputerscientist/urls.py +++ b/thatcomputerscientist/urls.py @@ -14,8 +14,9 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), + path('', include('blog.urls')), ] -- cgit v1.2.3