首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

python web 简单有关问题 新手

2012-05-15 
python web 简单问题 新手利用 django 已经配置好网站http://127.0.0.1:8000/但根据教程修改了urls.py改为

python web 简单问题 新手
利用 django 已经配置好网站

http://127.0.0.1:8000/

但根据教程修改了urls.py  
改为

Python code
urlpatterns = patterns('',    # Example:    # (r'^mysite/', include('mysite.foo.urls')),    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'     # to INSTALLED_APPS to enable admin documentation:    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),     (r'^$', 'mysite.helloworld.index'),    # Uncomment the next line to enable the admin:    # (r'^admin/', include(admin.site.urls)),)


这个helloword.py已经写好
Python code
#!/usr/bin/env python#Filename helloword.pyfrom django.http import HttpResponsedef index(request):    return HttpResponse("Hello, Django.")


但是刷新 http://127.0.0.1:8000/ 就报错了
错误提示:Could not import mysite.helloworld. Error was: No module named helloworld

[解决办法]
没用过django,注意你的文件名helloworld.py

热点排行