author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Tue, 22 Dec 2020 13:45:36 +0200 | |
changeset 2482 | b6e75fabe00b |
parent 2228 | 837f1337c59b |
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; -*- |
1015 | 2 |
|
3 |
========= |
|
4 |
Django. |
|
5 |
========= |
|
1346
a2fbf50a43f4
Fix: Has no 'contents::' directive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
6 |
.. contents:: |
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
7 |
:local: |
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 |
||
2228
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
32 |
Start server |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
33 |
============ |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
34 |
:: |
1027 | 35 |
|
36 |
$ ./manage.py runserver |
|
37 |
$ ./manage.py runserver 8080 |