python编程_第6章

学习Django+book的可以参照下面的信息。
在mysite下面创建完books后,继续按着例子走,出现以下问题:
pytho manage.py validate
Error: One or more models did not validate:
books.author: "headshot": To use ImageFields, you need to install the python Imaging Library. Get it at http://www.pythonware.com/products/pil/ .

好了,去以上网站安装相应的pil就可以了,我安装完2.5的pil就OK了

按照教程走到第6章又出现了以下的问题:
from django.conf.urls.defaults import *
urlpatterns = patterns('',
**(r'^admin/', include('django.contrib.admin.urls')),**
)
教程中说把注释去掉就可以了,但是我运行却出错误了,因为在我的mysite下urls.py中得内容如下:
# Examples:
# url(r'^$', 'mytemplate.views.home', name='home'),
# url(r'^mytemplate/', include('mytemplate.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)),

所以我的内容应该做相应的修改,现改为:
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
)

现在运行python manage.py runserver就可以了,website 输入:http://127.0.0.1:8000/admin/doc/就可以出来登录界面了。
OK,今天到此为止!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值