Detailed steps as follows:python
sudo apt-get install mysql-server mysql-client sudo apt-get install python-pip sudo pip install Django==1.6.5 sudo apt-get install python-mysqldb
create a new project:mysql
django-admin.py startproject project-name
then,create a new app:web
python manage.py startapp app-name
running service as follows:sql
python manage.py runserver # 當提示端口被佔用的時候,能夠用其它端口: python manage.py runserver 8001 python manage.py runserver 9999 (固然也能夠kill掉佔用端口的進程) # 監聽全部可用 ip (電腦可能有一個或多個內網ip,一個或多個外網ip,即有多個ip地址) python manage.py runserver 0.0.0.0:8000 # 若是是外網或者局域網電腦上能夠用其它電腦查看開發服務器 # 訪問對應的 ip加端口,好比 http://172.16.20.2:8000
this is default page:apache
add an app name to the "settings.py" django
then,modify subdomain/views.py file as follows:服務器
#coding:utf-8 from django.http import HttpResponse def index(request): return HttpResponse(u"webcome to first page!this is index...")
modify webtest/urls.py file as follows:app
urlpatterns = patterns('', # Examples: # url(r'^$', 'webtest.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$','subdomain.views.index'), url(r'^admin/', include(admin.site.urls)), )