`
jiguanghover
  • 浏览: 13474 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

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,今天到此为止!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics