base template extension

This commit is contained in:
Sharad Ahlawat 2020-03-09 20:13:13 -07:00
parent 522ffac9a0
commit 9ade5edae8
5 changed files with 23 additions and 2 deletions

View File

@ -37,6 +37,8 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'products.apps.ProductsConfig',
'accounts.apps.AccountsConfig',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -54,7 +56,7 @@ ROOT_URLCONF = 'producthunt.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')] 'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'producthunt/templates')]
, ,
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {

View File

@ -0,0 +1,11 @@
This is the Top
<br />
{% block content %}
{% endblock %}
<br />
This is the Bottom

View File

@ -17,7 +17,9 @@ from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
from products import views
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', views.home, name='home'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -0,0 +1,4 @@
{% extends 'base.html' %}
{% block content %}
HI
{% endblock %}

View File

@ -1,3 +1,5 @@
from django.shortcuts import render from django.shortcuts import render
# Create your views here.
def home(request):
return render(request, 'products/home.html')