aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorTeddy Wing2014-04-19 19:54:06 -0400
committerTeddy Wing2014-04-19 19:54:06 -0400
commit97f1a5787085bd52bcea28edf10204bd9c2d43d2 (patch)
treeab92b6be5c32b3d4c535d4719a768fbd30d04876 /examples
parentcf7099b8cb8e3061175e483682238936618c1d24 (diff)
downloaddjango-sneak-peek-97f1a5787085bd52bcea28edf10204bd9c2d43d2.tar.bz2
Get example django project up & running
The minimum amount of configuration necessary to get the example Django project to serve a static index page.
Diffstat (limited to 'examples')
-rw-r--r--examples/djangoproject/djangoproject/settings.py15
-rw-r--r--examples/djangoproject/djangoproject/templates/base.html15
-rw-r--r--examples/djangoproject/djangoproject/templates/index.html6
-rw-r--r--examples/djangoproject/djangoproject/urls.py14
4 files changed, 28 insertions, 22 deletions
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 @@
+<!DOCTYPE html>
+{% load static %}
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
+ <meta charset="utf-8">
+ <title>Sneak Peek Example</title>
+</head>
+<body>
+ <header>Sneak Peek Example</header>
+
+ {% block content %}
+ {% endblock %}
+</body>
+</html> \ 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'),
)