django.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:46:36 +0200
changeset 1905 fba288d59662
parent 1346 a2fbf50a43f4
child 1912 8b81a8f0f692
permissions -rw-r--r--
Include only local subsections into TOC. This prevent duplication of TOC when build single page HTML document. Also this make unnecessary CSS hack to hide document title as top level section.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1027
diff changeset
     1
.. -*- coding: utf-8; -*-
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1027
diff changeset
     2
.. include:: HEADER.rst
1015
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
=========
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
 Django.
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
=========
1346
a2fbf50a43f4 Fix: Has no 'contents::' directive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
     7
.. contents::
1905
fba288d59662 Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1346
diff changeset
     8
   :local:
1015
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
Hello world Django app.
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
=======================
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
::
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  $ cd ~/devel
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
  $ django-admin.py startproject dj
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
  $ cd dj
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
  $ django-admin.py startapp hello
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
  $ cat >hello/views.py <<EOF
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
  from django.http import HttpResponse
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
  def hello(request):
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
      return HttpResponse("Hello world")
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
  EOF
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
  $ cat >urls.py <<EOF
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
  from django.conf.urls.defaults import patterns, include, url
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
  from hello.views import hello
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
  urlpatterns = patterns(
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
      '',
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
      url(r'^hello/$', hello),
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
  )
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  EOF
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
  $ ./manage.py runserver
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
1027
9a6a2f647258 Start server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
    33
Start server.
9a6a2f647258 Start server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
    34
=============
9a6a2f647258 Start server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
    35
9a6a2f647258 Start server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
    36
  $ ./manage.py runserver
9a6a2f647258 Start server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
    37
  $ ./manage.py runserver 8080