author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 19 Oct 2015 17:04:52 +0300 | |
changeset 1769 | cadd23f8127f |
parent 1346 | a2fbf50a43f4 |
child 1905 | fba288d59662 |
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:: |
1015 | 8 |
|
9 |
Hello world Django app. |
|
10 |
======================= |
|
11 |
:: |
|
12 |
||
13 |
$ cd ~/devel |
|
14 |
$ django-admin.py startproject dj |
|
15 |
$ cd dj |
|
16 |
$ django-admin.py startapp hello |
|
17 |
$ cat >hello/views.py <<EOF |
|
18 |
from django.http import HttpResponse |
|
19 |
def hello(request): |
|
20 |
return HttpResponse("Hello world") |
|
21 |
EOF |
|
22 |
$ cat >urls.py <<EOF |
|
23 |
from django.conf.urls.defaults import patterns, include, url |
|
24 |
from hello.views import hello |
|
25 |
urlpatterns = patterns( |
|
26 |
'', |
|
27 |
url(r'^hello/$', hello), |
|
28 |
) |
|
29 |
EOF |
|
30 |
$ ./manage.py runserver |
|
31 |
||
1027 | 32 |
Start server. |
33 |
============= |
|
34 |
||
35 |
$ ./manage.py runserver |
|
36 |
$ ./manage.py runserver 8080 |