Make first view with template work
This commit is contained in:
parent
7415ec4bbf
commit
fa2443d11d
|
@ -4,3 +4,6 @@ __pycache__
|
|||
|
||||
# Ignore sqlite db
|
||||
*.sqlite3
|
||||
|
||||
# Ignore private.py since it contains secrets
|
||||
shorturl/shorturl/private.py
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'REPLACE THIS VALUE BEFORE USING IT IN PRODUCTION'
|
|
@ -9,6 +9,8 @@ https://docs.djangoproject.com/en/3.1/topics/settings/
|
|||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/3.1/ref/settings/
|
||||
"""
|
||||
# Import private settings from private.py
|
||||
from .private import *
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
@ -19,9 +21,6 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'dg0e#z95djls+s_b7o(x8$zc*3%vnr0gy4!8vx#&(9lbw%dwu-'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
|
@ -54,7 +53,7 @@ ROOT_URLCONF = 'shorturl.urls'
|
|||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'DIRS': ['shorturl/templates'],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Foo! Bar!
|
|
@ -15,7 +15,9 @@ Including another URLconf
|
|||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', views.index, name='index'),
|
||||
]
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
from django.http import HttpResponse
|
||||
from django.template import loader
|
||||
|
||||
def index(request):
|
||||
template = loader.get_template('index.html')
|
||||
context = {}
|
||||
return HttpResponse(template.render(context, request))
|
Loading…
Reference in New Issue