From 39850fe5e8a23b402610167e33540ee615aed3ab Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Tue, 4 Dec 2012 14:52:04 -0500 Subject: Create home page --- codemash/settings.py | 5 +++++ codemash/urls.py | 2 +- pages/views.py | 8 +++++++- templates/index.html | 13 +++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 templates/index.html diff --git a/codemash/settings.py b/codemash/settings.py index 0e609fd..3bf0f6a 100644 --- a/codemash/settings.py +++ b/codemash/settings.py @@ -1,5 +1,7 @@ # Django settings for codemash project. +import os + DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -21,6 +23,8 @@ DATABASES = { } } +PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) + # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. @@ -107,6 +111,7 @@ TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. + os.path.join(PROJECT_ROOT, "templates"), ) INSTALLED_APPS = ( diff --git a/codemash/urls.py b/codemash/urls.py index 153db34..2fae4f3 100644 --- a/codemash/urls.py +++ b/codemash/urls.py @@ -6,7 +6,7 @@ from django.conf.urls import patterns, include, url urlpatterns = patterns('', # Examples: - # url(r'^$', 'pages.views.home', name='home'), + url(r'^$', 'pages.views.home', name='home'), # url(r'^codemash/', include('codemash.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: diff --git a/pages/views.py b/pages/views.py index 60f00ef..b656b34 100644 --- a/pages/views.py +++ b/pages/views.py @@ -1 +1,7 @@ -# Create your views here. +from django.shortcuts import render + + +def home(request): + """The home page view + """ + return render(request, "index.html") diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..a522fbd --- /dev/null +++ b/templates/index.html @@ -0,0 +1,13 @@ + + + + + + Hello Codemash + + + +

Hello Codemash

+

You've just created your first Django page. Pretty cool, eh?

+ + -- cgit v1.2.3