推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
shoumu
V2EX  ›  Python

django 返回 pdf,其它机器上无法下载

  •  
  •   shoumu ·
    shoumu · Apr 23, 2014 · 3413 views
    This topic created in 4429 days ago, the information mentioned may be changed or developed.
    具体是这样子的,在服务器上用django上面通过下面的代码返回一个pdf
    response = HttpResponse(content_type='application/pdf')
    response.write(pdf)
    return response

    现在在我的电脑上能够得到这个pdf,其它电脑上却不能够,请问这是为什么?
    Supplement 1  ·  Apr 24, 2014
    已经解决,是我用ajax把数据post上去了,数据返回给了ajax。用form提交即可
    3 replies    2014-04-30 00:29:21 +08:00
    manoon
        1
    manoon  
       Apr 24, 2014
    编码,或者浏览器。
    shoumu
        2
    shoumu  
    OP
       Apr 24, 2014
    @manoon 经验证是我装了IDM让我的机器能够下载的,去掉就不能了。
    但是我的浏览器中能够获得相应的数据,就是无法弹出提示下载的框
    cloudream
        3
    cloudream  
       Apr 30, 2014
    response['Content-Disposition'] = 'filename="somefilename.pdf"'
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1378 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 17:09 · PVG 01:09 · LAX 10:09 · JFK 13:09
    ♥ Do have faith in what you're doing.