django.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 22 Feb 2016 12:41:52 +0200
changeset 1903 901e7394849f
parent 1346 a2fbf50a43f4
child 1905 fba288d59662
permissions -rw-r--r--
Decrease intent to increase space usage on mobile.
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::
1015
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Hello world Django app.
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
=======================
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
  $ cd ~/devel
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
  $ django-admin.py startproject dj
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
  $ cd dj
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
  $ django-admin.py startapp hello
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
  $ cat >hello/views.py <<EOF
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
  from django.http import HttpResponse
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
  def hello(request):
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
      return HttpResponse("Hello world")
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
  EOF
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
  $ cat >urls.py <<EOF
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
  from django.conf.urls.defaults import patterns, include, url
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
  from hello.views import hello
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
  urlpatterns = patterns(
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
      '',
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
      url(r'^hello/$', hello),
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
  )
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
  EOF
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  $ ./manage.py runserver
7c40890db9ed Hello world Django app.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
1027
9a6a2f647258 Start server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
    32
Start server.
9a6a2f647258 Start server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
    33
=============
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
  $ ./manage.py runserver
9a6a2f647258 Start server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
    36
  $ ./manage.py runserver 8080