Python XHTML2PDF Django[Errno 10061]无法建立连接,因为目标计算机主动拒绝了它

Python XHTML2PDF Django[Errno 10061]无法建立连接,因为目标计算机主动拒绝了它,python,django,Python,Django,我已经用XAMPP和mod_wsgi部署了我的django应用程序。在部署应用程序之前,一切都很好。然而,在我部署它之后,pdf Dowland函数将无法工作并返回错误 这是我的代码快照 def render_to_pdf(template_src, context_dict, file_name): template = get_template(template_src) context = Context(context_dict) html = template

我已经用XAMPP和mod_wsgi部署了我的django应用程序。在部署应用程序之前,一切都很好。然而,在我部署它之后,pdf Dowland函数将无法工作并返回错误

这是我的代码快照

def render_to_pdf(template_src, context_dict, file_name):
    template = get_template(template_src)
    context = Context(context_dict)
    html  = template.render(context)
    result = StringIO.StringIO()
    pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), result)
    if not pdf.err:
        response = http.HttpResponse(content_type='application/pdf')
        response['Content-Disposition'] = 'attachment; filename="%s"' %(file_name,)
        response.write(result.getvalue())
        return response
    return http.HttpResponse('We had some errors<pre>%s</pre>' % cgi.escape(html))
下面是导致错误的代码行

C:\Python27x32\Lib\socket.py in create_connection, line 571
异常位置:

<VirtualHost *:80>
    WSGIScriptAlias / "c:/xampp/htdocs/ghb/ghb/wsgi.py"

    <Directory "c:/xampp/htdocs/ghb/">
        <Files wsgi.py>
            Order deny,allow
            Allow from all
        </Files>
    </Directory>

    Alias /static/ C:/xampp/htdocs/ghb/static/

    <Directory c:/xampp/htdocs/ghb/static/>
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>
这是我的wsgi.py的代码


WSGIScriptAlias/“c:/xampp/htdocs/ghb/ghb/wsgi.py”
命令拒绝,允许
通融
别名/static/C:/xampp/htdocs/ghb/static/
命令拒绝,允许
通融

以下是从第400行开始的
错误日志中可以找到相关的回溯。从这个回溯中,在我看来,您的HTML包含一个不起作用的URL(可能是指向图像的链接?)(可能指向
localhost
,在您的桌面上起作用,但在服务器上不起作用?);xhtml2pdf试图获取该URL(可能是将图像包含在PDF中?)但失败。检查
html
变量(传递给xhtml2pdf的html代码)的内容是否存在损坏的
http:
https:
链接。通过跟踪回溯中的文件名+行引用(如第448行的
文件“C:\\Python27x32\\lib\\site packages\\xhtml2pdf\\parser.py”),您可以更准确地确定哪个元素xhtml2pdf阻塞。

相关回溯可以在
错误.log
中找到,从第400行开始。从这个回溯中,在我看来,您的HTML包含一个不起作用的URL(可能是指向图像的链接?)(可能指向
localhost
,在您的桌面上起作用,但在服务器上不起作用?);xhtml2pdf试图获取该URL(可能是将图像包含在PDF中?)但失败。检查
html
变量(传递给xhtml2pdf的html代码)的内容是否存在损坏的
http:
https:
链接。通过跟踪回溯中的文件名+行引用(如第448行的
文件“C:\\Python27x32\\lib\\site packages\\xhtml2pdf\\parser.py”),您可以更准确地确定哪个元素xhtml2pdf阻塞。

相关回溯可以在
错误.log
中找到,从第400行开始。从这个回溯中,在我看来,您的HTML包含一个不起作用的URL(可能是指向图像的链接?)(可能指向
localhost
,在您的桌面上起作用,但在服务器上不起作用?);xhtml2pdf试图获取该URL(可能是将图像包含在PDF中?)但失败。检查
html
变量(传递给xhtml2pdf的html代码)的内容是否存在损坏的
http:
https:
链接。通过跟踪回溯中的文件名+行引用(如第448行的
文件“C:\\Python27x32\\lib\\site packages\\xhtml2pdf\\parser.py”),您可以更准确地确定哪个元素xhtml2pdf阻塞。

相关回溯可以在
错误.log
中找到,从第400行开始。从这个回溯中,在我看来,您的HTML包含一个不起作用的URL(可能是指向图像的链接?)(可能指向
localhost
,在您的桌面上起作用,但在服务器上不起作用?);xhtml2pdf试图获取该URL(可能是将图像包含在PDF中?)但失败。检查
html
变量(传递给xhtml2pdf的html代码)的内容是否存在损坏的
http:
https:
链接。通过跟踪回溯中的文件名+行引用(如
文件“C:\\Python27x32\\lib\\site packages\\xhtml2pdf\\parser.py”,第448行
),您可以更精确地确定哪个元素xhtml2pdf阻塞。

您可以显示完整的回溯吗?我已经编辑了我的问题您可以显示完整的回溯吗?我已经编辑了我的问题您可以显示完整的回溯吗?我已经编辑了我的问题您可以显示完整的回溯吗?我已经编辑了我的问题
C:\Python27x32\Lib\socket.py in create_connection, line 571
<VirtualHost *:80>
    WSGIScriptAlias / "c:/xampp/htdocs/ghb/ghb/wsgi.py"

    <Directory "c:/xampp/htdocs/ghb/">
        <Files wsgi.py>
            Order deny,allow
            Allow from all
        </Files>
    </Directory>

    Alias /static/ C:/xampp/htdocs/ghb/static/

    <Directory c:/xampp/htdocs/ghb/static/>
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>