读书人

python web 简单有关问题 新手

发布时间: 2012-05-15 14:35:29 作者: rapoo

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

读书人网 >perl python

热点推荐