use django to create website:


1、create new django project

#django-admin.py startproject test1
test1/
├── manage.py
└── test1
    ├── __init__.py
    ├── settings.py
    ├── urls.py
    └── wsgi.py


2、create new django application,in the new project directory:

#python manage.py startapp web
test1/
├── manage.py
├── test1
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── settings.py
│   ├── settings.pyc
│   ├── urls.py
│   └── wsgi.py
└── web
    ├── admin.py
    ├── __init__.py
    ├── migrations
    │   └── __init__.py
    ├── models.py
    ├── tests.py
    └── views.py


3、add the new application to project's settings.py in INSTALLED_APPS:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'test1',
)

4、create view in the application's views.py:

from django.http import HttpResponse
def index(request):
        return HttpResponse("hello django!")


5、in project's urls.py,add mapping to the application:

from test1.views import index
urlpatterns = patterns('',
    url(r'^test1/', 'test1.views.index'),
)


6、url:http://ip:8000/test1