V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
peterkai
V2EX  ›  Python

django+uwsgi 访问 https url 的问题

  •  
  •   peterkai · 2015-05-12 15:41:21 +08:00 · 2168 次点击
    这是一个创建于 3294 天前的主题,其中的信息可能已经有所发展或是发生改变。
    大家好,我现在用django+uwsgi+nginx搭建了一个网站。

    遇到了一个自认为比较奇葩的https url的访问问题

    我的django版本1.6, uwsgi版本2.0.4,python版本 2.7.3

    我在django shell里是可以正常访问https url的,如下所示:

    In [1]: import urllib2

    In [2]: response=urllib2.urlopen("https://www.baidu.com")

    In [3]: data=resposne.read()

    In [4]: data=response.read()

    In [5]: print data

    工作正常.

    但是如果我用uwsgi启动程序之后,使用相同的代码就会出现如下错误:

    urlopen error unknown url type: https

    完全搞不清楚原因了,请各位大神帮忙
    2 条回复    2015-05-13 10:37:37 +08:00
    ericls
        1
    ericls  
       2015-05-12 16:59:29 +08:00
    所以这个跟 Django 和 uWSGI 有啥关系?
    你 uWSGI 启动的时候提示的 interpreter 和你 shell 用的 python interpreter 是一样的么?
    peterkai
        2
    peterkai  
    OP
       2015-05-13 10:37:37 +08:00
    应该是以前uwsgi编译方式有问题
    今天重新编译了uwsgi 问题搞定
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   903 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 22:08 · PVG 06:08 · LAX 15:08 · JFK 18:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.