1.创建项目File–>new Project
2.创建完的目录结构如下
3.修改urls.py的内容
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'Django.views.home', name='home'), # url(r'^Django/', include('Django.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), #意思是访问blog/index执行views里面的index方法 url(r'^blog/index$','blog.views.index'), )
修改views.py的内容
from django.http import HttpResponse def index(reg): return HttpResponse("
Hello Django!
")右上角选择Django服务器,点击绿色三角形按钮开始执行
成功执行显示下面语句