Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simplified default project template.

Squashed commit of:

commit 508ec91
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 22:50:55 2013 +0100

    Tweaked default settings file.

    * Explained why BASE_DIR exists.
    * Added a link to the database configuration options, and put it in its
      own section.
    * Moved sensitive settings that must be changed for production at the
      top.

commit 6515fd2
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 14:35:21 2013 +0100

    Documented the simplified app & project templates in the changelog.

commit 2c5b576
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 13:59:27 2013 +0100

    Minor fixes in tutorials 5 and 6.

commit 55a5153
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 13:51:11 2013 +0100

    Updated tutorial 2 for the new project template.

commit 29ddae8
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 11:58:54 2013 +0100

    Updated tutorial 1 for the new project template.

commit 0ecb9f6
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 11:29:13 2013 +0100

    Adjusted the default URLconf detection to account for the admin.

    It's now enabled by default.

commit 5fb4da0
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 10:36:55 2013 +0100

    Added security warnings for the most sensitive settings.

commit 718d84b
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 23:24:06 2013 +0100

    Used an absolute path for the SQLite database.

    This ensures the settings file works regardless of which directory
    django-admin.py / manage.py is invoked from.

    BASE_DIR got a +1 from a BDFL and another core dev. It doesn't involve
    the concept of a "Django project"; it's just a convenient way to express
    relative paths within the source code repository for non-Python files.

    Thanks Jacob Kaplan-Moss for the suggestion.

commit 1b559b4
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 23:22:40 2013 +0100

    Removed STATIC_ROOT from the default settings template.

    It isn't necessary in development, and it confuses beginners to no end.

    Thanks Carl Meyer for the suggestion.

commit a55f141
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 23:21:43 2013 +0100

    Removed MEDIA_ROOT/URL from default settings template.

    Many sites will never deal with user-uploaded files, and MEDIA_ROOT is
    complicated to explain.

    Thanks Carl Meyer for the suggestion.

commit 44bf2f2441420fd9429ee9fe1f7207f92dd87e70
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 22:22:09 2013 +0100

    Removed logging config.

    This configuration is applied regardless of the value of LOGGING;
    duplicating it in LOGGING is confusing.

commit eac747e848eaed65fd5f6f254f0a7559d856f88f
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 22:05:31 2013 +0100

    Enabled the locale middleware by default.

    USE_I18N is True by default, and doesn't work well without
    LocaleMiddleware.

commit d806c62b2d00826dc2688c84b092627b8d571cab
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 22:03:16 2013 +0100

    Enabled clickjacking protection by default.

commit 99152c30e6a15003f0b6737dc78e87adf462aacb
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 22:01:48 2013 +0100

    Reorganized settings in logical sections, and trimmed comments.

commit d37ffdfcb24b7e0ec7cc113d07190f65fb12fb8a
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 16:54:11 2013 +0100

    Avoided misleading TEMPLATE_DEBUG = DEBUG.

    According to the docs TEMPLATE_DEBUG works only when DEBUG = True.

commit 15d9478d3a9850e85841e7cf09cf83050371c6bf
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 16:46:25 2013 +0100

    Removed STATICFILES_FINDERS/TEMPLATE_LOADERS from default settings file.

    Only developers with special needs ever need to change these settings.

commit 574da0eb5bfb4570883756914b4dbd7e20e1f61e
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 16:45:01 2013 +0100

    Removed STATICFILES/TEMPLATES_DIRS from default settings file.

    The current best practice is to put static files and templates in
    applications, for easier testing and deployment.

commit 8cb18dbe56629aa1be74718a07e7cc66b4f9c9f0
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 16:24:16 2013 +0100

    Removed settings related to email reporting from default settings file.

    While handy for small scale projects, it isn't exactly a best practice.

commit 8ecbfcb3638058f0c49922540f874a7d802d864f
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 18:54:43 2013 +0100

    Documented how to enable the sites framework.

commit 23fc91a6fa67d91ddd9d71b1c3e0dc26bdad9841
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 16:28:59 2013 +0100

    Disabled the sites framework by default.

    RequestSite does the job for single-domain websites.

commit c4d82eb8afc0eb8568bf9c4d12644272415e3960
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Jan 29 00:08:33 2013 +0100

    Added a default admin.py to the application template.

    Thanks Ryan D Hiebert for the suggestion.

commit 4071dc771e5c44b1c5ebb9beecefb164ae465e22
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 10:59:49 2013 +0100

    Enabled the admin by default.

    Everyone uses the admin.

commit c807a31f8d89e7e7fd97380e3023f7983a8b6fcb
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 10:57:05 2013 +0100

    Removed admindocs from default project template.

commit 09e4ce0e652a97da1a9e285046a91c8ad7a9189c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 16:32:52 2013 +0100

    Added links to the settings documentation.

commit 5b8f5eaef364eb790fcde6f9e86f7d266074cca8
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 11:06:54 2013 +0100

    Used a significant example for URLconf includes.

commit 908e91d6fcee2a3cb51ca26ecdf12a6a24e69ef8
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 16:22:31 2013 +0100

    Moved code comments about WSGI to docs, and rewrote said docs.

commit 50417e51996146f891d08ca8b74dcc736a581932
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Jan 28 15:51:50 2013 +0100

    Normalized the default application template.

    Removed the default test that 1 + 1 = 2, because it's been committed
    way too many times, in too many projects.

    Added an import of `render` for views, because the first view will
    often be:

    def home(request):
        return render(request, "mysite/home.html")
  • Loading branch information...
commit 3f1c7b70537330435e2ec2fca9550f7b7fa4372e 1 parent 21ea58b
Aymeric Augustin authored January 28, 2013
3  django/conf/app_template/admin.py
... ...
@@ -0,0 +1,3 @@
  1
+from django.contrib import admin
  2
+
  3
+# Register your models here.
15  django/conf/app_template/tests.py
... ...
@@ -1,16 +1,3 @@
1  
-"""
2  
-This file demonstrates writing tests using the unittest module. These will pass
3  
-when you run "manage.py test".
4  
-
5  
-Replace this with more appropriate tests for your application.
6  
-"""
7  
-
8 1
 from django.test import TestCase
9 2
 
10  
-
11  
-class SimpleTest(TestCase):
12  
-    def test_basic_addition(self):
13  
-        """
14  
-        Tests that 1 + 1 always equals 2.
15  
-        """
16  
-        self.assertEqual(1 + 1, 2)
  3
+# Create your tests here.
2  django/conf/app_template/views.py
... ...
@@ -1 +1,3 @@
  1
+from django.shortcuts import render
  2
+
1 3
 # Create your views here.
178  django/conf/project_template/project_name/settings.py
... ...
@@ -1,152 +1,82 @@
1  
-# Django settings for {{ project_name }} project.
  1
+"""
  2
+Django settings for {{ project_name }} project.
2 3
 
3  
-DEBUG = True
4  
-TEMPLATE_DEBUG = DEBUG
5  
-
6  
-ADMINS = (
7  
-    # ('Your Name', 'your_email@example.com'),
8  
-)
9  
-
10  
-MANAGERS = ADMINS
11  
-
12  
-DATABASES = {
13  
-    'default': {
14  
-        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
15  
-        'NAME': '',                      # Or path to database file if using sqlite3.
16  
-        # The following settings are not used with sqlite3:
17  
-        'USER': '',
18  
-        'PASSWORD': '',
19  
-        'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
20  
-        'PORT': '',                      # Set to empty string for default.
21  
-    }
22  
-}
23  
-
24  
-# Local time zone for this installation. Choices can be found here:
25  
-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
26  
-# although not all choices may be available on all operating systems.
27  
-# In a Windows environment this must be set to your system time zone.
28  
-TIME_ZONE = 'America/Chicago'
29  
-
30  
-# Language code for this installation. All choices can be found here:
31  
-# http://www.i18nguy.com/unicode/language-identifiers.html
32  
-LANGUAGE_CODE = 'en-us'
33  
-
34  
-SITE_ID = 1
35  
-
36  
-# If you set this to False, Django will make some optimizations so as not
37  
-# to load the internationalization machinery.
38  
-USE_I18N = True
  4
+For more information on this file, see
  5
+https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/
39 6
 
40  
-# If you set this to False, Django will not format dates, numbers and
41  
-# calendars according to the current locale.
42  
-USE_L10N = True
  7
+For the full list of settings and their values, see
  8
+https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/
  9
+"""
43 10
 
44  
-# If you set this to False, Django will not use timezone-aware datetimes.
45  
-USE_TZ = True
  11
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  12
+import os
  13
+BASE_DIR = os.path.dirname(os.path.dirname(__file__))
46 14
 
47  
-# Absolute filesystem path to the directory that will hold user-uploaded files.
48  
-# Example: "/var/www/example.com/media/"
49  
-MEDIA_ROOT = ''
50 15
 
51  
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
52  
-# trailing slash.
53  
-# Examples: "http://example.com/media/", "http://media.example.com/"
54  
-MEDIA_URL = ''
  16
+# Quick-start development settings - unsuitable for production
55 17
 
56  
-# Absolute path to the directory static files should be collected to.
57  
-# Don't put anything in this directory yourself; store your static files
58  
-# in apps' "static/" subdirectories and in STATICFILES_DIRS.
59  
-# Example: "/var/www/example.com/static/"
60  
-STATIC_ROOT = ''
  18
+# SECURITY WARNING: keep the secret key used in production secret!
  19
+# Hardcoded values can leak through source control. Consider loading
  20
+# the secret key from an environment variable or a file instead.
  21
+SECRET_KEY = '{{ secret_key }}'
61 22
 
62  
-# URL prefix for static files.
63  
-# Example: "http://example.com/static/", "http://static.example.com/"
64  
-STATIC_URL = '/static/'
  23
+# SECURITY WARNING: don't run with debug turned on in production!
  24
+DEBUG = True
65 25
 
66  
-# Additional locations of static files
67  
-STATICFILES_DIRS = (
68  
-    # Put strings here, like "/home/html/static" or "C:/www/django/static".
69  
-    # Always use forward slashes, even on Windows.
70  
-    # Don't forget to use absolute paths, not relative paths.
71  
-)
  26
+TEMPLATE_DEBUG = True
72 27
 
73  
-# List of finder classes that know how to find static files in
74  
-# various locations.
75  
-STATICFILES_FINDERS = (
76  
-    'django.contrib.staticfiles.finders.FileSystemFinder',
77  
-    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
78  
-    # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
79  
-)
80 28
 
81  
-# Make this unique, and don't share it with anybody.
82  
-SECRET_KEY = '{{ secret_key }}'
  29
+# Application definition
83 30
 
84  
-# List of callables that know how to import templates from various sources.
85  
-TEMPLATE_LOADERS = (
86  
-    'django.template.loaders.filesystem.Loader',
87  
-    'django.template.loaders.app_directories.Loader',
88  
-    # 'django.template.loaders.eggs.Loader',
  31
+INSTALLED_APPS = (
  32
+    'django.contrib.admin',
  33
+    'django.contrib.auth',
  34
+    'django.contrib.contenttypes',
  35
+    'django.contrib.sessions',
  36
+    'django.contrib.messages',
  37
+    'django.contrib.staticfiles',
89 38
 )
90 39
 
91 40
 MIDDLEWARE_CLASSES = (
92  
-    'django.middleware.common.CommonMiddleware',
93 41
     'django.contrib.sessions.middleware.SessionMiddleware',
  42
+    'django.middleware.locale.LocaleMiddleware',
  43
+    'django.middleware.common.CommonMiddleware',
94 44
     'django.middleware.csrf.CsrfViewMiddleware',
95 45
     'django.contrib.auth.middleware.AuthenticationMiddleware',
96 46
     'django.contrib.messages.middleware.MessageMiddleware',
97  
-    # Uncomment the next line for simple clickjacking protection:
98  
-    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  47
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
99 48
 )
100 49
 
101 50
 ROOT_URLCONF = '{{ project_name }}.urls'
102 51
 
103  
-# Python dotted path to the WSGI application used by Django's runserver.
104 52
 WSGI_APPLICATION = '{{ project_name }}.wsgi.application'
105 53
 
106  
-TEMPLATE_DIRS = (
107  
-    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
108  
-    # Always use forward slashes, even on Windows.
109  
-    # Don't forget to use absolute paths, not relative paths.
110  
-)
111 54
 
112  
-INSTALLED_APPS = (
113  
-    'django.contrib.auth',
114  
-    'django.contrib.contenttypes',
115  
-    'django.contrib.sessions',
116  
-    'django.contrib.sites',
117  
-    'django.contrib.messages',
118  
-    'django.contrib.staticfiles',
119  
-    # Uncomment the next line to enable the admin:
120  
-    # 'django.contrib.admin',
121  
-    # Uncomment the next line to enable admin documentation:
122  
-    # 'django.contrib.admindocs',
123  
-)
  55
+# Database
  56
+# https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#databases
124 57
 
125  
-# A sample logging configuration. The only tangible logging
126  
-# performed by this configuration is to send an email to
127  
-# the site admins on every HTTP 500 error when DEBUG=False.
128  
-# See http://docs.djangoproject.com/en/dev/topics/logging for
129  
-# more details on how to customize your logging configuration.
130  
-LOGGING = {
131  
-    'version': 1,
132  
-    'disable_existing_loggers': False,
133  
-    'filters': {
134  
-        'require_debug_false': {
135  
-            '()': 'django.utils.log.RequireDebugFalse'
136  
-        }
137  
-    },
138  
-    'handlers': {
139  
-        'mail_admins': {
140  
-            'level': 'ERROR',
141  
-            'filters': ['require_debug_false'],
142  
-            'class': 'django.utils.log.AdminEmailHandler'
143  
-        }
144  
-    },
145  
-    'loggers': {
146  
-        'django.request': {
147  
-            'handlers': ['mail_admins'],
148  
-            'level': 'ERROR',
149  
-            'propagate': True,
150  
-        },
  58
+DATABASES = {
  59
+    'default': {
  60
+        'ENGINE': 'django.db.backends.sqlite3',
  61
+        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
151 62
     }
152 63
 }
  64
+
  65
+# Internationalization
  66
+# https://docs.djangoproject.com/en/{{ docs_version }}/topics/i18n/
  67
+
  68
+LANGUAGE_CODE = 'en-us'
  69
+
  70
+TIME_ZONE = 'UTC'
  71
+
  72
+USE_I18N = True
  73
+
  74
+USE_L10N = True
  75
+
  76
+USE_TZ = True
  77
+
  78
+
  79
+# Static files (CSS, JavaScript, Images)
  80
+# https://docs.djangoproject.com/en/{{ docs_version }}/howto/static-files/
  81
+
  82
+STATIC_URL = '/static/'
13  django/conf/project_template/project_name/urls.py
... ...
@@ -1,17 +1,12 @@
1 1
 from django.conf.urls import patterns, include, url
2 2
 
3  
-# Uncomment the next two lines to enable the admin:
4  
-# from django.contrib import admin
5  
-# admin.autodiscover()
  3
+from django.contrib import admin
  4
+admin.autodiscover()
6 5
 
7 6
 urlpatterns = patterns('',
8 7
     # Examples:
9 8
     # url(r'^$', '{{ project_name }}.views.home', name='home'),
10  
-    # url(r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')),
  9
+    # url(r'^blog/', include('blog.urls')),
11 10
 
12  
-    # Uncomment the admin/doc line below to enable admin documentation:
13  
-    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
14  
-
15  
-    # Uncomment the next line to enable the admin:
16  
-    # url(r'^admin/', include(admin.site.urls)),
  11
+    url(r'^admin/', include(admin.site.urls)),
17 12
 )
26  django/conf/project_template/project_name/wsgi.py
... ...
@@ -1,32 +1,14 @@
1 1
 """
2 2
 WSGI config for {{ project_name }} project.
3 3
 
4  
-This module contains the WSGI application used by Django's development server
5  
-and any production WSGI deployments. It should expose a module-level variable
6  
-named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
7  
-this application via the ``WSGI_APPLICATION`` setting.
8  
-
9  
-Usually you will have the standard Django WSGI application here, but it also
10  
-might make sense to replace the whole Django WSGI application with a custom one
11  
-that later delegates to the Django one. For example, you could introduce WSGI
12  
-middleware here, or combine a Django application with an application of another
13  
-framework.
  4
+It exposes the WSGI callable as a module-level variable named ``application``.
14 5
 
  6
+For more information on this file, see
  7
+https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/wsgi/
15 8
 """
16  
-import os
17 9
 
18  
-# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
19  
-# if running multiple sites in the same mod_wsgi process. To fix this, use
20  
-# mod_wsgi daemon mode with each site in its own daemon process, or use
21  
-# os.environ["DJANGO_SETTINGS_MODULE"] = "{{ project_name }}.settings"
  10
+import os
22 11
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
23 12
 
24  
-# This application object is used by any WSGI server configured to use this
25  
-# file. This includes Django's development server, if the WSGI_APPLICATION
26  
-# setting points here.
27 13
 from django.core.wsgi import get_wsgi_application
28 14
 application = get_wsgi_application()
29  
-
30  
-# Apply WSGI middleware here.
31  
-# from helloworld.wsgi import HelloWorldApplication
32  
-# application = HelloWorldApplication(application)
5  django/core/management/templates.py
@@ -105,10 +105,15 @@ def handle(self, app_or_project, name, target=None, **options):
105 105
         base_name = '%s_name' % app_or_project
106 106
         base_subdir = '%s_template' % app_or_project
107 107
         base_directory = '%s_directory' % app_or_project
  108
+        if django.VERSION[-1] == 0:
  109
+            docs_version = 'dev'
  110
+        else:
  111
+            docs_version = '%d.%d' % django.VERSION[:2]
108 112
 
109 113
         context = Context(dict(options, **{
110 114
             base_name: name,
111 115
             base_directory: top_dir,
  116
+            'docs_version': docs_version,
112 117
         }), autoescape=False)
113 118
 
114 119
         # Setup a stub settings environment for template rendering
29  django/views/debug.py
@@ -438,9 +438,12 @@ def technical_404_response(request, exception):
438 438
     except (IndexError, TypeError, KeyError):
439 439
         tried = []
440 440
     else:
441  
-        if not tried:
442  
-            # tried exists but is an empty list. The URLconf must've been empty.
443  
-            return empty_urlconf(request)
  441
+        if (not tried                           # empty URLconf
  442
+            or (request.path == '/'
  443
+                and len(tried) == 1             # default URLconf
  444
+                and len(tried[0]) == 1
  445
+                and tried[0][0].app_name == tried[0][0].namespace == 'admin')):
  446
+            return default_urlconf(request)
444 447
 
445 448
     urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF)
446 449
     if isinstance(urlconf, types.ModuleType):
@@ -458,12 +461,10 @@ def technical_404_response(request, exception):
458 461
     })
459 462
     return HttpResponseNotFound(t.render(c), content_type='text/html')
460 463
 
461  
-def empty_urlconf(request):
  464
+def default_urlconf(request):
462 465
     "Create an empty URLconf 404 error response."
463  
-    t = Template(EMPTY_URLCONF_TEMPLATE, name='Empty URLConf template')
464  
-    c = Context({
465  
-        'project_name': settings.SETTINGS_MODULE.split('.')[0]
466  
-    })
  466
+    t = Template(DEFAULT_URLCONF_TEMPLATE, name='Default URLconf template')
  467
+    c = Context({})
467 468
     return HttpResponse(t.render(c), content_type='text/html')
468 469
 
469 470
 #
@@ -1067,7 +1068,7 @@ def empty_urlconf(request):
1067 1068
 </html>
1068 1069
 """
1069 1070
 
1070  
-EMPTY_URLCONF_TEMPLATE = """
  1071
+DEFAULT_URLCONF_TEMPLATE = """
1071 1072
 <!DOCTYPE html>
1072 1073
 <html lang="en"><head>
1073 1074
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
@@ -1087,7 +1088,6 @@ def empty_urlconf(request):
1087 1088
     tbody td, tbody th { vertical-align:top; padding:2px 3px; }
1088 1089
     thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; }
1089 1090
     tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; }
1090  
-    ul { margin-left: 2em; margin-top: 1em; }
1091 1091
     #summary { background: #e0ebff; }
1092 1092
     #summary h2 { font-weight: normal; color: #666; }
1093 1093
     #explanation { background:#eee; }
@@ -1103,11 +1103,10 @@ def empty_urlconf(request):
1103 1103
 </div>
1104 1104
 
1105 1105
 <div id="instructions">
1106  
-  <p>Of course, you haven't actually done any work yet. Here's what to do next:</p>
1107  
-  <ul>
1108  
-    <li>If you plan to use a database, edit the <code>DATABASES</code> setting in <code>{{ project_name }}/settings.py</code>.</li>
1109  
-    <li>Start your first app by running <code>python manage.py startapp [appname]</code>.</li>
1110  
-  </ul>
  1106
+  <p>
  1107
+    Of course, you haven't actually done any work yet.
  1108
+    Next, start your first app by running <code>python manage.py startapp [appname]</code>.
  1109
+  </p>
1111 1110
 </div>
1112 1111
 
1113 1112
 <div id="explanation">
99  docs/howto/deployment/wsgi/index.txt
@@ -8,9 +8,10 @@ servers and applications.
8 8
 .. _WSGI: http://www.wsgi.org
9 9
 
10 10
 Django's :djadmin:`startproject` management command sets up a simple default
11  
-WSGI configuration for you, which you can tweak as needed for your project, and
12  
-direct any WSGI-compliant webserver to use. Django includes getting-started
13  
-documentation for the following WSGI servers:
  11
+WSGI configuration for you, which you can tweak as needed for your project,
  12
+and direct any WSGI-compliant application server to use.
  13
+
  14
+Django includes getting-started documentation for the following WSGI servers:
14 15
 
15 16
 .. toctree::
16 17
    :maxdepth: 1
@@ -23,32 +24,76 @@ documentation for the following WSGI servers:
23 24
 The ``application`` object
24 25
 --------------------------
25 26
 
26  
-One key concept of deploying with WSGI is to specify a central ``application``
27  
-callable object which the webserver uses to communicate with your code. This is
28  
-commonly specified as an object named ``application`` in a Python module
29  
-accessible to the server.
  27
+The key concept of deploying with WSGI is the ``application`` callable which
  28
+the application server uses to communicate with your code. It's commonly
  29
+provided as an object named ``application`` in a Python module accessible to
  30
+the server.
  31
+
  32
+The :djadmin:`startproject` command creates a file
  33
+:file:`<project_name>/wsgi.py` that contains such an ``application`` callable.
  34
+
  35
+It's used both by Django's development server and in production WSGI
  36
+deployments.
  37
+
  38
+WSGI servers obtain the path to the ``application`` callable from their
  39
+configuration. Django's built-in servers, namely the :djadmin:`runserver` and
  40
+:djadmin:`runfcgi` commands, read it from the :setting:`WSGI_APPLICATION`
  41
+setting. By default, it's set to ``<project_name>.wsgi.application``, which
  42
+points to the ``application`` callable in :file:`<project_name>/wsgi.py`.
  43
+
  44
+Configuring the settings module
  45
+-------------------------------
  46
+
  47
+When the WSGI server loads your application, Django needs to import the
  48
+settings module — that's where your entire application is defined.
  49
+
  50
+Django uses the :envvar:`DJANGO_SETTINGS_MODULE` environment variable to
  51
+locate the appropriate settings module. It must contain the dotted path to the
  52
+settings module. You can use a different value for development and production;
  53
+it all depends on how you organize your settings.
30 54
 
31  
-The :djadmin:`startproject` command creates a :file:`projectname/wsgi.py` that
32  
-contains such an application callable.
  55
+If this variable isn't set, the default :file:`wsgi.py` sets it to
  56
+``mysite.settings``, where ``mysite`` is the name of your project. That's how
  57
+:djadmin:`runserver` discovers the default settings file by default.
33 58
 
34 59
 .. note::
35 60
 
36  
-   Upgrading from a previous release of Django and don't have a :file:`wsgi.py`
37  
-   file in your project? You can simply add one to your project's top-level
38  
-   Python package (probably next to :file:`settings.py` and :file:`urls.py`)
39  
-   with the contents below. If you want :djadmin:`runserver` to also make use
40  
-   of this WSGI file, you can also add ``WSGI_APPLICATION =
41  
-   "mysite.wsgi.application"`` in your settings (replacing ``mysite`` with the
42  
-   name of your project).
  61
+    Since environment variables are process-wide, this doesn't work when you
  62
+    run multiple Django sites in the same process. This happens with mod_wsgi.
43 63
 
44  
-Initially this file contains::
  64
+    To avoid this problem, use mod_wsgi's daemon mode with each site in its
  65
+    own daemon process, or override the value from the environnemnt by
  66
+    enforcing ``os.environ["DJANGO_SETTINGS_MODULE"] = "mysite.settings"`` in
  67
+    your :file:`wsgi.py`.
45 68
 
46  
-    import os
47 69
 
  70
+Applying WSGI middleware
  71
+------------------------
  72
+
  73
+To apply `WSGI middleware`_ you can simply wrap the application object. For
  74
+istance you could add these lines at the bottom of :file:`wsgi.py`::
  75
+
  76
+    from helloworld.wsgi import HelloWorldApplication
  77
+    application = HelloWorldApplication(application)
  78
+
  79
+You could also replace the Django WSGI application with a custom WSGI
  80
+application that later delegates to the Django WSGI application, if you want
  81
+to combine a Django application with a WSGI application of another framework.
  82
+
  83
+.. _`WSGI middleware`: http://www.python.org/dev/peps/pep-3333/#middleware-components-that-play-both-sides
  84
+
  85
+Upgrading from Django < 1.4
  86
+---------------------------
  87
+
  88
+If you're upgrading from Django 1.3.x or earlier, you don't have a
  89
+:file:`wsgi.py` file in your project.
  90
+
  91
+You can simply add one to your project's top-level Python package (probably
  92
+next to :file:`settings.py` and :file:`urls.py`) with the contents below::
  93
+
  94
+    import os
48 95
     os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
49 96
 
50  
-    # This application object is used by the development server
51  
-    # as well as any WSGI server configured to use this file.
52 97
     from django.core.wsgi import get_wsgi_application
53 98
     application = get_wsgi_application()
54 99
 
@@ -58,14 +103,6 @@ environment variable. You'll need to edit this line to replace ``mysite`` with
58 103
 the name of your project package, so the path to your settings module is
59 104
 correct.
60 105
 
61  
-To apply `WSGI middleware`_ you can simply wrap the application object
62  
-in the same file::
63  
-
64  
-    from helloworld.wsgi import HelloWorldApplication
65  
-    application = HelloWorldApplication(application)
66  
-
67  
-You could also replace the Django WSGI application with a custom WSGI
68  
-application that later delegates to the Django WSGI application, if you want to
69  
-combine a Django application with a WSGI application of another framework.
70  
-
71  
-.. _`WSGI middleware`: http://www.python.org/dev/peps/pep-3333/#middleware-components-that-play-both-sides
  106
+Also add ``WSGI_APPLICATION = "mysite.wsgi.application"`` in your settings, so
  107
+that :djadmin:`runserver` finds your ``application`` callable. Don't forget to
  108
+replace ``mysite`` with the name of your project in this line.
4  docs/howto/error-reporting.txt
@@ -39,8 +39,8 @@ By default, Django will send email from root@localhost. However, some mail
39 39
 providers reject all email from this address. To use a different sender
40 40
 address, modify the :setting:`SERVER_EMAIL` setting.
41 41
 
42  
-To disable this behavior, just remove all entries from the :setting:`ADMINS`
43  
-setting.
  42
+To activate this behavior, put the email addresses of the recipients in the
  43
+:setting:`ADMINS` setting.
44 44
 
45 45
 .. seealso::
46 46
 
BIN  docs/intro/_images/admin02.png
BIN  docs/intro/_images/admin02t.png
BIN  docs/intro/_images/admin03.png
BIN  docs/intro/_images/admin03t.png
2  docs/intro/reusable-apps.txt
@@ -63,8 +63,8 @@ After the previous tutorials, our project should look like this::
63 63
             urls.py
64 64
             wsgi.py
65 65
         polls/
66  
-            admin.py
67 66
             __init__.py
  67
+            admin.py
68 68
             models.py
69 69
             tests.py
70 70
             urls.py
110  docs/intro/tutorial01.txt
@@ -182,40 +182,40 @@ Database setup
182 182
 --------------
183 183
 
184 184
 Now, edit :file:`mysite/settings.py`. It's a normal Python module with
185  
-module-level variables representing Django settings. Change the
186  
-following keys in the :setting:`DATABASES` ``'default'`` item to match
187  
-your database connection settings.
  185
+module-level variables representing Django settings.
  186
+
  187
+By default, the configuration uses SQLite. If you're new to databases, or
  188
+you're just interested in trying Django, this is the easiest choice. SQLite is
  189
+included in Python, so you won't need to install anything else to support your
  190
+database.
  191
+
  192
+If you wish to use another database, install the appropriate :ref:`database
  193
+bindings <database-installation>`, and change the following keys in the
  194
+:setting:`DATABASES` ``'default'`` item to match your database connection
  195
+settings:
188 196
 
189 197
 * :setting:`ENGINE <DATABASE-ENGINE>` -- Either
  198
+  ``'django.db.backends.sqlite3'``,
190 199
   ``'django.db.backends.postgresql_psycopg2'``,
191  
-  ``'django.db.backends.mysql'``, ``'django.db.backends.sqlite3'`` or
  200
+  ``'django.db.backends.mysql'``, or
192 201
   ``'django.db.backends.oracle'``. Other backends are :setting:`also available
193 202
   <DATABASE-ENGINE>`.
194 203
 
195  
-* :setting:`NAME` -- The name of your database. If you're using
196  
-  SQLite, the database will be a file on your computer; in that
197  
-  case, :setting:`NAME` should be the full absolute path,
198  
-  including filename, of that file. If the file doesn't exist, it
199  
-  will automatically be created when you synchronize the database
200  
-  for the first time (see below).
201  
-
202  
-  When specifying the path, always use forward slashes, even on
203  
-  Windows (e.g. ``C:/homes/user/mysite/sqlite3.db``).
  204
+* :setting:`NAME` -- The name of your database. If you're using SQLite, the
  205
+  database will be a file on your computer; in that case, :setting:`NAME`
  206
+  should be the full absolute path, including filename, of that file. When
  207
+  specifying the path, always use forward slashes, even on Windows (e.g.
  208
+  ``C:/homes/user/mysite/sqlite3.db``).
204 209
 
205 210
 * :setting:`USER` -- Your database username (not used for SQLite).
206 211
 
207  
-* :setting:`PASSWORD` -- Your database password (not used for
208  
-  SQLite).
  212
+* :setting:`PASSWORD` -- Your database password (not used for SQLite).
209 213
 
210  
-* :setting:`HOST` -- The host your database is on. Leave this as
211  
-  an empty string (or possibly ``127.0.0.1``) if your database server is on the
212  
-  same physical machine (not used for SQLite). See :setting:`HOST` for details.
  214
+* :setting:`HOST` -- The host your database is on (not used for SQLite).
  215
+  Leave this as an empty string (or possibly ``127.0.0.1``) if your
  216
+  database server is on the same physical machine .
213 217
 
214  
-If you're new to databases, we recommend simply using SQLite by setting
215  
-:setting:`ENGINE <DATABASE-ENGINE>` to ``'django.db.backends.sqlite3'`` and
216  
-:setting:`NAME` to the place where you'd like to store the database. SQLite is
217  
-included in Python, so you won't need to install anything else to support your
218  
-database.
  218
+For more details, see the reference documentation for :setting:`DATABASES`.
219 219
 
220 220
 .. note::
221 221
 
@@ -226,17 +226,20 @@ database.
226 226
     If you're using SQLite, you don't need to create anything beforehand - the
227 227
     database file will be created automatically when it is needed.
228 228
 
229  
-While you're editing :file:`settings.py`, set :setting:`TIME_ZONE` to your
230  
-time zone. The default value is the Central time zone in the U.S. (Chicago).
  229
+While you're editing :file:`mysite/settings.py`, set :setting:`TIME_ZONE` to
  230
+your time zone.
231 231
 
232  
-Also, note the :setting:`INSTALLED_APPS` setting toward the bottom of
233  
-the file. That holds the names of all Django applications that are
234  
-activated in this Django instance. Apps can be used in multiple projects, and
235  
-you can package and distribute them for use by others in their projects.
  232
+Also, note the :setting:`INSTALLED_APPS` setting at the top of the file. That
  233
+holds the names of all Django applications that are activated in this Django
  234
+instance. Apps can be used in multiple projects, and you can package and
  235
+distribute them for use by others in their projects.
236 236
 
237 237
 By default, :setting:`INSTALLED_APPS` contains the following apps, all of which
238 238
 come with Django:
239 239
 
  240
+* :mod:`django.contrib.admin` -- The admin site. You'll use it in :doc:`part 2
  241
+  of this tutorial </intro/tutorial02>`.
  242
+
240 243
 * :mod:`django.contrib.auth` -- An authentication system.
241 244
 
242 245
 * :mod:`django.contrib.contenttypes` -- A framework for content types.
@@ -261,11 +264,12 @@ that, run the following command:
261 264
 
262 265
     python manage.py syncdb
263 266
 
264  
-The :djadmin:`syncdb` command looks at the :setting:`INSTALLED_APPS` setting and
265  
-creates any necessary database tables according to the database settings in your
266  
-:file:`settings.py` file. You'll see a message for each database table it
267  
-creates, and you'll get a prompt asking you if you'd like to create a superuser
268  
-account for the authentication system. Go ahead and do that.
  267
+The :djadmin:`syncdb` command looks at the :setting:`INSTALLED_APPS` setting
  268
+and creates any necessary database tables according to the database settings
  269
+in your :file:`mysqlite/settings.py` file. You'll see a message for each
  270
+database table it creates, and you'll get a prompt asking you if you'd like to
  271
+create a superuser account for the authentication system. Go ahead and do
  272
+that.
269 273
 
270 274
 If you're interested, run the command-line client for your database and type
271 275
 ``\dt`` (PostgreSQL), ``SHOW TABLES;`` (MySQL), or ``.schema`` (SQLite) to
@@ -288,10 +292,10 @@ Creating models
288 292
 Now that your environment -- a "project" -- is set up, you're set to start
289 293
 doing work.
290 294
 
291  
-Each application you write in Django consists of a Python package, somewhere
292  
-on your `Python path`_, that follows a certain convention. Django comes with a
293  
-utility that automatically generates the basic directory structure of an app,
294  
-so you can focus on writing code rather than creating directories.
  295
+Each application you write in Django consists of a Python package that follows
  296
+a certain convention. Django comes with a utility that automatically generates
  297
+the basic directory structure of an app, so you can focus on writing code
  298
+rather than creating directories.
295 299
 
296 300
 .. admonition:: Projects vs. apps
297 301
 
@@ -316,6 +320,7 @@ That'll create a directory :file:`polls`, which is laid out like this::
316 320
 
317 321
     polls/
318 322
         __init__.py
  323
+        admin.py
319 324
         models.py
320 325
         tests.py
321 326
         views.py
@@ -401,26 +406,21 @@ But first we need to tell our project that the ``polls`` app is installed.
401 406
     you can distribute apps, because they don't have to be tied to a given
402 407
     Django installation.
403 408
 
404  
-Edit the :file:`settings.py` file again, and change the
405  
-:setting:`INSTALLED_APPS` setting to include the string ``'polls'``. So
406  
-it'll look like this::
  409
+Edit the :file:`mysite/settings.py` file again, and change the
  410
+:setting:`INSTALLED_APPS` setting to include the string ``'polls'``. So it'll
  411
+look like this::
407 412
 
408 413
     INSTALLED_APPS = (
  414
+        'django.contrib.admin',
409 415
         'django.contrib.auth',
410 416
         'django.contrib.contenttypes',
411 417
         'django.contrib.sessions',
412  
-        'django.contrib.sites',
413 418
         'django.contrib.messages',
414 419
         'django.contrib.staticfiles',
415  
-        # Uncomment the next line to enable the admin:
416  
-        # 'django.contrib.admin',
417  
-        # Uncomment the next line to enable admin documentation:
418  
-        # 'django.contrib.admindocs',
419 420
         'polls',
420 421
     )
421 422
 
422  
-Now Django knows to include the ``polls`` app. Let's run another
423  
-command:
  423
+Now Django knows to include the ``polls`` app. Let's run another command:
424 424
 
425 425
 .. code-block:: bash
426 426
 
@@ -433,13 +433,13 @@ statements for the polls app):
433 433
 
434 434
     BEGIN;
435 435
     CREATE TABLE "polls_poll" (
436  
-        "id" serial NOT NULL PRIMARY KEY,
  436
+        "id" integer NOT NULL PRIMARY KEY,
437 437
         "question" varchar(200) NOT NULL,
438  
-        "pub_date" timestamp with time zone NOT NULL
  438
+        "pub_date" datetime NOT NULL
439 439
     );
440 440
     CREATE TABLE "polls_choice" (
441  
-        "id" serial NOT NULL PRIMARY KEY,
442  
-        "poll_id" integer NOT NULL REFERENCES "polls_poll" ("id") DEFERRABLE INITIALLY DEFERRED,
  441
+        "id" integer NOT NULL PRIMARY KEY,
  442
+        "poll_id" integer NOT NULL REFERENCES "polls_poll" ("id"),
443 443
         "choice_text" varchar(200) NOT NULL,
444 444
         "votes" integer NOT NULL
445 445
     );
@@ -447,7 +447,8 @@ statements for the polls app):
447 447
 
448 448
 Note the following:
449 449
 
450  
-* The exact output will vary depending on the database you are using.
  450
+* The exact output will vary depending on the database you are using. The
  451
+  example above is generated for SQLite.
451 452
 
452 453
 * Table names are automatically generated by combining the name of the app
453 454
   (``polls``) and the lowercase name of the model -- ``poll`` and
@@ -465,8 +466,7 @@ Note the following:
465 466
   types such as ``auto_increment`` (MySQL), ``serial`` (PostgreSQL), or
466 467
   ``integer primary key`` (SQLite) are handled for you automatically. Same
467 468
   goes for quoting of field names -- e.g., using double quotes or single
468  
-  quotes. The author of this tutorial runs PostgreSQL, so the example
469  
-  output is in PostgreSQL syntax.
  469
+  quotes.
470 470
 
471 471
 * The :djadmin:`sql` command doesn't actually run the SQL in your database -
472 472
   it just prints it to the screen so that you can see what SQL Django thinks
103  docs/intro/tutorial02.txt
@@ -21,49 +21,11 @@ automatically-generated admin site.
21 21
     The admin isn't intended to be used by site visitors. It's for site
22 22
     managers.
23 23
 
24  
-Activate the admin site
25  
-=======================
26  
-
27  
-The Django admin site is not activated by default -- it's an opt-in thing. To
28  
-activate the admin site for your installation, do these three things:
29  
-
30  
-* Uncomment ``"django.contrib.admin"`` in the :setting:`INSTALLED_APPS` setting.
31  
-
32  
-* Run ``python manage.py syncdb``. Since you have added a new application
33  
-  to :setting:`INSTALLED_APPS`, the database tables need to be updated.
34  
-
35  
-* Edit your ``mysite/urls.py`` file and uncomment the lines that reference
36  
-  the admin -- there are three lines in total to uncomment. This file is a
37  
-  URLconf; we'll dig into URLconfs in the next tutorial. For now, all you
38  
-  need to know is that it maps URL roots to applications. In the end, you
39  
-  should have a ``urls.py`` file that looks like this:
40  
-
41  
-  .. parsed-literal::
42  
-
43  
-      from django.conf.urls import patterns, include, url
44  
-
45  
-      # Uncomment the next two lines to enable the admin:
46  
-      **from django.contrib import admin**
47  
-      **admin.autodiscover()**
48  
-
49  
-      urlpatterns = patterns('',
50  
-          # Examples:
51  
-          # url(r'^$', '{{ project_name }}.views.home', name='home'),
52  
-          # url(r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')),
53  
-
54  
-          # Uncomment the admin/doc line below to enable admin documentation:
55  
-          # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
56  
-
57  
-          # Uncomment the next line to enable the admin:
58  
-          **url(r'^admin/', include(admin.site.urls)),**
59  
-      )
60  
-
61  
-  (The bold lines are the ones that needed to be uncommented.)
62  
-
63 24
 Start the development server
64 25
 ============================
65 26
 
66  
-Let's start the development server and explore the admin site.
  27
+The Django admin site is activated by default. Let's start the development
  28
+server and explore it.
67 29
 
68 30
 Recall from Tutorial 1 that you start the development server like so:
69 31
 
@@ -77,6 +39,10 @@ http://127.0.0.1:8000/admin/. You should see the admin's login screen:
77 39
 .. image:: _images/admin01.png
78 40
    :alt: Django admin login screen
79 41
 
  42
+Since :doc:`translation </topics/i18n/translation>` is turned on by default,
  43
+the login screen may be displayed in your own language, depending on your
  44
+browser's settings and on whether Django has a translation for this language.
  45
+
80 46
 .. admonition:: Doesn't match what you see?
81 47
 
82 48
     If at this point, instead of the above login page, you get an error
@@ -93,24 +59,26 @@ http://127.0.0.1:8000/admin/. You should see the admin's login screen:
93 59
 Enter the admin site
94 60
 ====================
95 61
 
96  
-Now, try logging in. (You created a superuser account in the first part of this
  62
+Now, try logging in. You created a superuser account in the first part of this
97 63
 tutorial, remember?  If you didn't create one or forgot the password you can
98  
-:ref:`create another one <topics-auth-creating-superusers>`.) You should see
99  
-the Django admin index page:
  64
+:ref:`create another one <topics-auth-creating-superusers>`.
  65
+
  66
+You should see the Django admin index page:
100 67
 
101 68
 .. image:: _images/admin02t.png
102 69
    :alt: Django admin index page
103 70
 
104  
-You should see a few types of editable content, including groups, users
105  
-and sites. These are core features Django ships with by default.
  71
+You should see a few types of editable content: groups and users. They are
  72
+provided by :mod:`django.contrib.auth`, the authentication framework shipped
  73
+by Django.
106 74
 
107 75
 Make the poll app modifiable in the admin
108 76
 =========================================
109 77
 
110 78
 But where's our poll app? It's not displayed on the admin index page.
111 79
 
112  
-Just one thing to do: We need to tell the admin that ``Poll``
113  
-objects have an admin interface. To do this, create a file called
  80
+Just one thing to do: we need to tell the admin that ``Poll``
  81
+objects have an admin interface. To do this, open the file called
114 82
 ``admin.py`` in your ``polls`` directory, and edit it to look like this::
115 83
 
116 84
     from django.contrib import admin
@@ -118,10 +86,6 @@ objects have an admin interface. To do this, create a file called
118 86
 
119 87
     admin.site.register(Poll)
120 88
 
121  
-You'll need to restart the development server to see your changes. Normally,
122  
-the server auto-reloads code every time you modify a file, but the action of
123  
-creating a new file doesn't trigger the auto-reloading logic.
124  
-
125 89
 Explore the free admin functionality
126 90
 ====================================
127 91
 
@@ -145,7 +109,7 @@ Click the "What's up?" poll to edit it:
145 109
 
146 110
 Things to note here:
147 111
 
148  
-* The form is automatically generated from the Poll model.
  112
+* The form is automatically generated from the ``Poll`` model.
149 113
 
150 114
 * The different model field types (:class:`~django.db.models.DateTimeField`,
151 115
   :class:`~django.db.models.CharField`) correspond to the appropriate HTML
@@ -302,7 +266,7 @@ registration code to read::
302 266
 This tells Django: "``Choice`` objects are edited on the ``Poll`` admin page. By
303 267
 default, provide enough fields for 3 choices."
304 268
 
305  
-Load the "Add poll" page to see how that looks, you may need to restart your development server:
  269
+Load the "Add poll" page to see how that looks:
306 270
 
307 271
 .. image:: _images/admin11t.png
308 272
    :alt: Add poll page now has choices on it
@@ -435,31 +399,24 @@ That's easy to change, though, using Django's template system. The Django admin
435 399
 is powered by Django itself, and its interfaces use Django's own template
436 400
 system.
437 401
 
438  
-Open your settings file (``mysite/settings.py``, remember) and look at the
439  
-:setting:`TEMPLATE_DIRS` setting. :setting:`TEMPLATE_DIRS` is a tuple of
440  
-filesystem directories to check when loading Django templates. It's a search
441  
-path.
442  
-
443 402
 Create a ``mytemplates`` directory in your project directory. Templates can
444 403
 live anywhere on your filesystem that Django can access. (Django runs as
445 404
 whatever user your server runs.) However, keeping your templates within the
446 405
 project is a good convention to follow.
447 406
 
448  
-By default, :setting:`TEMPLATE_DIRS` is empty. So, let's add a line to it, to
449  
-tell Django where our templates live::
450  
-
451  
-    TEMPLATE_DIRS = (
452  
-        '/path/to/mysite/mytemplates', # Change this to your own directory.
453  
-    )
454  
-
455  
-Now copy the template ``admin/base_site.html`` from within the default Django
456  
-admin template directory in the source code of Django itself
457  
-(``django/contrib/admin/templates``) into an ``admin`` subdirectory of
458  
-whichever directory you're using in :setting:`TEMPLATE_DIRS`. For example, if
459  
-your :setting:`TEMPLATE_DIRS` includes ``'/path/to/mysite/mytemplates'``, as
460  
-above, then copy ``django/contrib/admin/templates/admin/base_site.html`` to
461  
-``/path/to/mysite/mytemplates/admin/base_site.html``. Don't forget that
462  
-``admin`` subdirectory.
  407
+Open your settings file (``mysite/settings.py``, remember) and  add a
  408
+:setting:`TEMPLATE_DIRS` setting::
  409
+
  410
+    TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'mytemplates'),)
  411
+
  412
+Don't forget the trailing comma. :setting:`TEMPLATE_DIRS` is a tuple of
  413
+filesystem directories to check when loading Django templates; it's a search
  414
+path.
  415
+
  416
+Now create a directory called ``admin`` inside ``mytemplates``, and copy the
  417
+template ``admin/base_site.html`` from within the default Django admin
  418
+template directory in the source code of Django itself
  419
+(``django/contrib/admin/templates``) into that directory.
463 420
 
464 421
 .. admonition:: Where are the Django source files?
465 422
 
3  docs/intro/tutorial05.txt
@@ -159,8 +159,7 @@ can do in an automated test, so let's turn that into an automated test.
159 159
 The best place for an application's tests is in the application's ``tests.py``
160 160
 file - the testing system will look there for tests automatically.
161 161
 
162  
-Put the following in the ``tests.py`` file in the ``polls`` application (you'll
163  
-notice  ``tests.py`` contains some dummy tests, you can remove those)::
  162
+Put the following in the ``tests.py`` file in the ``polls`` application::
164 163
 
165 164
     import datetime
166 165
 
6  docs/ref/clickjacking.txt
@@ -51,7 +51,7 @@ How to use it
51 51
 Setting X-Frame-Options for all responses
52 52
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53 53
 
54  
-To set the same X-Frame-Options value for all responses in your site, add
  54
+To set the same X-Frame-Options value for all responses in your site, put
55 55
 ``'django.middleware.clickjacking.XFrameOptionsMiddleware'`` to
56 56
 :setting:`MIDDLEWARE_CLASSES`::
57 57
 
@@ -61,6 +61,10 @@ To set the same X-Frame-Options value for all responses in your site, add
61 61
         ...
62 62
     )
63 63
 
  64
+.. versionchanged:: 1.6
  65
+    This middleware is enabled in the settings file generated by
  66
+    :djadmin:`startproject`.
  67
+
64 68
 By default, the middleware will set the X-Frame-Options header to SAMEORIGIN for
65 69
 every outgoing ``HttpResponse``. If you want DENY instead, set the
66 70
 :setting:`X_FRAME_OPTIONS` setting::
8  docs/ref/contrib/admin/index.txt
@@ -14,7 +14,13 @@ Django's admin interface.
14 14
 Overview
15 15
 ========
16 16
 
17  
-There are seven steps in activating the Django admin site:
  17
+The admin is enabled in the default project template used by
  18
+:djadmin:`startproject`.
  19
+
  20
+.. versionchanged:: 1.6
  21
+    In previous versions, the admin wasn't enabled by default.
  22
+
  23
+For reference, here are the requirements:
18 24
 
19 25
 1. Add ``'django.contrib.admin'`` to your :setting:`INSTALLED_APPS`
20 26
    setting.
3  docs/ref/contrib/gis/tutorial.txt
@@ -115,13 +115,12 @@ In addition, modify the :setting:`INSTALLED_APPS` setting to include
115 115
 and ``world`` (your newly created application)::
116 116
 
117 117
     INSTALLED_APPS = (
  118
+        'django.contrib.admin',
118 119
         'django.contrib.auth',
119 120
         'django.contrib.contenttypes',
120 121
         'django.contrib.sessions',
121  
-        'django.contrib.sites',
122 122
         'django.contrib.messages',
123 123
         'django.contrib.staticfiles',
124  
-        'django.contrib.admin',
125 124
         'django.contrib.gis',
126 125
         'world'
127 126
     )
24  docs/ref/contrib/sites.txt
@@ -247,13 +247,29 @@ To do this, you can use the sites framework. A simple example::
247 247
     'http://example.com/mymodel/objects/3/'
248 248
 
249 249
 
250  
-Default site and ``syncdb``
251  
-===========================
  250
+Enabling the sites framework
  251
+============================
  252
+
  253
+.. versionchanged:: 1.6
  254
+    In previous versions, the sites framework was enabled by default.
  255
+
  256
+To enable the sites framework, follow these steps:
  257
+
  258
+1. Add ``'django.contrib.sites'`` to your :setting:`INSTALLED_APPS`
  259
+   setting.
  260
+
  261
+2. Define a :setting:`SITE_ID` setting::
  262
+
  263
+    SITE_ID = 1
  264
+
  265
+3. Run :djadmin:`syncdb`.
252 266
 
253 267
 ``django.contrib.sites`` registers a
254 268
 :data:`~django.db.models.signals.post_syncdb` signal handler which creates a
255  
-default site named ``example.com`` with the domain ``example.com``. For
256  
-example, this site will be created after Django creates the test database.
  269
+default site named ``example.com`` with the domain ``example.com``. This site
  270
+will also be created after Django creates the test database. To set the
  271
+correct name and domain for your project, you can use an :doc:`initial data
  272
+fixture </howto/initial-data>`.
257 273
 
258 274
 Caching the current ``Site`` object
259 275
 ===================================
4  docs/ref/django-admin.txt
@@ -921,6 +921,8 @@ For example::
921 921
 
922 922
     django-admin.py startapp myapp /Users/jezdez/Code/myapp
923 923
 
  924
+.. _custom-app-and-project-templates:
  925
+
924 926
 .. django-admin-option:: --template
925 927
 
926 928
 With the ``--template`` option, you can use a custom app template by providing
@@ -952,6 +954,7 @@ with the ``--name`` option. The :class:`template context
952 954
   options)
953 955
 - ``app_name`` -- the app name as passed to the command
954 956
 - ``app_directory`` -- the full path of the newly created app
  957
+- ``docs_version`` -- the version of the documentation: ``'dev'`` or ``'1.x'``
955 958
 
956 959
 .. _render_warning:
957 960
 
@@ -1021,6 +1024,7 @@ with the ``--name`` option. The :class:`template context
1021 1024
 - ``project_name`` -- the project name as passed to the command
1022 1025
 - ``project_directory`` -- the full path of the newly created project
1023 1026
 - ``secret_key`` -- a random key for the :setting:`SECRET_KEY` setting
  1027
+- ``docs_version`` -- the version of the documentation: ``'dev'`` or ``'1.x'``
1024 1028
 
1025 1029
 Please also see the :ref:`rendering warning <render_warning>` as mentioned
1026 1030
 for :djadmin:`startapp`.
19  docs/ref/settings.txt
@@ -1134,9 +1134,12 @@ LANGUAGE_CODE
1134 1134
 
1135 1135
 Default: ``'en-us'``
1136 1136
 
1137  
-A string representing the language code for this installation. This should be in
1138  
-standard :term:`language format<language code>`. For example, U.S. English is
1139  
-``"en-us"``. See :doc:`/topics/i18n/index`.
  1137
+A string representing the language code for this installation. This should be
  1138
+in standard :term:`language format<language code>`. For example, U.S. English
  1139
+is ``"en-us"``. See also the `list of language identifiers`_ and
  1140
+:doc:`/topics/i18n/index`.
  1141
+
  1142
+.. _list of language identifiers: http://www.i18nguy.com/unicode/language-identifiers.html
1140 1143
 
1141 1144
 .. setting:: LANGUAGE_COOKIE_NAME
1142 1145
 
@@ -1668,12 +1671,8 @@ TIME_ZONE
1668 1671
 
1669 1672
 Default: ``'America/Chicago'``
1670 1673
 
1671  
-A string representing the time zone for this installation, or
1672  
-``None``. `See available choices`_. (Note that list of available
1673  
-choices lists more than one on the same line; you'll want to use just
1674  
-one of the choices for a given time zone. For instance, one line says
1675  
-``'Europe/London GB GB-Eire'``, but you should use the first bit of
1676  
-that -- ``'Europe/London'`` -- as your :setting:`TIME_ZONE` setting.)
  1674
+A string representing the time zone for this installation, or ``None``. See
  1675
+the `list of time zones`_.
1677 1676
 
1678 1677
 Note that this isn't necessarily the time zone of the server. For example, one
1679 1678
 server may serve multiple Django-powered sites, each with a separate time zone
@@ -1706,7 +1705,7 @@ to ensure your processes are running in the correct environment.
1706 1705
     If you're running Django on Windows, :setting:`TIME_ZONE` must be set to
1707 1706
     match the system time zone.
1708 1707
 
1709  
-.. _See available choices: http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
  1708
+.. _list of time zones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones