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-- |
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 | 3 |
|
4 |
========= |
|
5 |
Django. |
|
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 | 9 |
|
10 |
Hello world Django app. |
|
11 |
======================= |
|
12 |
:: |
|
13 |
||
14 |
$ cd ~/devel |
|
15 |
$ django-admin.py startproject dj |
|
16 |
$ cd dj |
|
17 |
$ django-admin.py startapp hello |
|
18 |
$ cat >hello/views.py <<EOF |
|
19 |
from django.http import HttpResponse |
|
20 |
def hello(request): |
|
21 |
return HttpResponse("Hello world") |
|
22 |
EOF |
|
23 |
$ cat >urls.py <<EOF |
|
24 |
from django.conf.urls.defaults import patterns, include, url |
|
25 |
from hello.views import hello |
|
26 |
urlpatterns = patterns( |
|
27 |
'', |
|
28 |
url(r'^hello/$', hello), |
|
29 |
) |
|
30 |
EOF |
|
31 |
$ ./manage.py runserver |
|
32 |
||
1027 | 33 |
Start server. |
34 |
============= |
|
35 |
||
36 |
$ ./manage.py runserver |
|
37 |
$ ./manage.py runserver 8080 |