- 1 Creating a new project:
mypro
$ django-admin startproject mypro
mypro
├── manage.py
└── mypro
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
- 2 coding...
in views.py,
from django.http import HttpResponse
def root(request):
return HttpResponse("Hi, I'm root.")
def hello(request):
return HttpResponse("Hello world!")
in urls.py,
from django.conf.urls import url
from mypro.views import hello, root
urlpatterns = [
url(r'^$', root),
url(r'^hello/$', hello),
]
- 3 running...
$ python manage.py runserver