小编Tal*_*lal的帖子

渲染抛出错误AttributeError META - (urllib2中的异常位置:__ getattr__)

我按照这篇文章尝试从外部网站加载图像.我试图从外部链接拉出所有图像.我使用BeautifulSoup来解析链接并获得所有必需的链接.

在视图调用代码末尾的render()函数之前,image_list和return_dict具有所需的值.但是渲染函数似乎生成了AttributeError异常.请协助.

我收到以下错误:

    AttributeError at /post/add_new/
    META
    Request Method: POST
    Request URL:    http://localhost:8000/post/add_new/
    Django Version: 1.4.1
    Exception Type: AttributeError
    Exception Value:    
    META
    Exception Location: C:\Python27\lib\urllib2.py in __getattr__, line 225
    Python Executable:  C:\Python27\python.exe
    Python Version: 2.7.3
    Python Path:    
    ['C:\\Users\\Talal\\Python Workspace\\talal_ynd',
     'C:\\Python27\\lib\\site-packages\\ipython-0.13-py2.7.egg',
     'C:\\Python27\\lib\\site-packages\\pyreadline-2.0_dev1-py2.7-win32.egg',
     'C:\\Python27\\lib\\site-packages\\pil-1.1.7-py2.7-win32.egg',
     'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg',
     'C:\\windows\\system32\\python27.zip',
     'C:\\Python27\\DLLs',
     'C:\\Python27\\lib',
     'C:\\Python27\\lib\\plat-win',
     'C:\\Python27\\lib\\lib-tk',
     'C:\\Python27',
     'C:\\Python27\\lib\\site-packages']
    Server time:    Thu, 13 Sep 2012 17:30:45 +0500
Run Code Online (Sandbox Code Playgroud)

这是我的视图文件:

# Create your views here.
from django.shortcuts import render
from django.http import HttpResponseRedirect
from posts.models import Post, PostForm
from …
Run Code Online (Sandbox Code Playgroud)

python django urllib2 attributeerror

4
推荐指数
1
解决办法
883
查看次数

标签 统计

attributeerror ×1

django ×1

python ×1

urllib2 ×1