From 97f1a5787085bd52bcea28edf10204bd9c2d43d2 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 19 Apr 2014 19:54:06 -0400 Subject: Get example django project up & running The minimum amount of configuration necessary to get the example Django project to serve a static index page. --- examples/djangoproject/djangoproject/settings.py | 15 +++++---------- examples/djangoproject/djangoproject/templates/base.html | 15 +++++++++++++++ examples/djangoproject/djangoproject/templates/index.html | 6 ++++++ examples/djangoproject/djangoproject/urls.py | 14 ++------------ 4 files changed, 28 insertions(+), 22 deletions(-) create mode 100644 examples/djangoproject/djangoproject/templates/base.html create mode 100644 examples/djangoproject/djangoproject/templates/index.html (limited to 'examples/djangoproject') diff --git a/examples/djangoproject/djangoproject/settings.py b/examples/djangoproject/djangoproject/settings.py index 68059e0..d572de8 100644 --- a/examples/djangoproject/djangoproject/settings.py +++ b/examples/djangoproject/djangoproject/settings.py @@ -1,13 +1,10 @@ -# Django settings for djangoproject project. +import os -DEBUG = True -TEMPLATE_DEBUG = DEBUG -ADMINS = ( - # ('Your Name', 'your_email@example.com'), -) +PROJECT_ROOT = os.path.dirname(__file__) -MANAGERS = ADMINS +DEBUG = True +TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { @@ -106,9 +103,7 @@ ROOT_URLCONF = 'djangoproject.urls' WSGI_APPLICATION = 'djangoproject.wsgi.application' 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/examples/djangoproject/djangoproject/templates/base.html b/examples/djangoproject/djangoproject/templates/base.html new file mode 100644 index 0000000..5611973 --- /dev/null +++ b/examples/djangoproject/djangoproject/templates/base.html @@ -0,0 +1,15 @@ + +{% load static %} + + + + + Sneak Peek Example + + +
Sneak Peek Example
+ + {% block content %} + {% endblock %} + + \ No newline at end of file diff --git a/examples/djangoproject/djangoproject/templates/index.html b/examples/djangoproject/djangoproject/templates/index.html new file mode 100644 index 0000000..e0008f6 --- /dev/null +++ b/examples/djangoproject/djangoproject/templates/index.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} + + +{% block content %} +test +{% endblock %} \ No newline at end of file diff --git a/examples/djangoproject/djangoproject/urls.py b/examples/djangoproject/djangoproject/urls.py index 99b073e..7c1817b 100644 --- a/examples/djangoproject/djangoproject/urls.py +++ b/examples/djangoproject/djangoproject/urls.py @@ -1,17 +1,7 @@ from django.conf.urls import patterns, include, url +from django.views.generic.base import TemplateView -# Uncomment the next two lines to enable the admin: -# from django.contrib import admin -# admin.autodiscover() urlpatterns = patterns('', - # Examples: - # url(r'^$', 'djangoproject.views.home', name='home'), - # url(r'^djangoproject/', include('djangoproject.foo.urls')), - - # Uncomment the admin/doc line below to enable admin documentation: - # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - - # Uncomment the next line to enable the admin: - # url(r'^admin/', include(admin.site.urls)), + url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'), ) -- cgit v1.2.3