Django Https issue

27 views
Skip to first unread message

zichua...@163.com

unread,
May 12, 2015, 6:02:33 AM5/12/15
to django...@googlegroups.com
Hi guys
I am using django 1.6 + uwsgi + nginx deploying a web site
I cant visit https url with urllib2 when i use uwsgi ,  if i dont use uwsgi ,then i can visit https url:
use django shell without uwsgi:
In [1]: import urllib2
In [4]: response=urllib2.urlopen("https://www.baidu.com")
In [6]: data=response.read()

In [7]: print data
<html>
<head>
        <script>
                location.replace(location.href.replace("https://","http://"));
        </script>
</head>
<body>
        <noscript><meta http-equiv="refresh" content="0;url=http://www.baidu.com/"></noscript>
</body>
</html>
It works fine
use django shell with uwsgi:
I get an error:<urlopen error unknown url type: https>


I dont konw why,Can you guys help me,thanks!!



Thomas Levine

unread,
May 12, 2015, 7:04:52 AM5/12/15
to django...@googlegroups.com
I searched the internet for this error message

On 11 May 20:41, zichua...@163.com wrote:
> *use django shell with uwsgi:*
> *I get an error:**<urlopen error unknown url type: https>*
>
> <https://lh3.googleusercontent.com/-PhdW_H9DyVo/VVF2Z2DPXWI/AAAAAAAAAAU/6COi8mqv5To/s1600/16%28%24%400%28V%29JFZ8%7EU%5BB%60%7BK%5B7J.jpg>

and came across reports like this one.
http://www.xinotes.net/notes/note/628/

On 11 May 20:41, zichua...@163.com wrote:
> Hi guys
> I am using django 1.6 + uwsgi + nginx deploying a web site
> I cant visit https url with urllib2 when i use uwsgi , if i dont use uwsgi
> ,then i can visit https url:

Could it be that you are running different versions of Python with
uwsgi verses without uwsgi? (I'm not entirely sure what you mean by
that, by the way, so it might help to elaborate.)

Try running this in both the uwsgi and non-uwsgi environments.

import sys
print(sys.version)
print(sys.path)

Any difference in the output between the two versions is very relevant.
And if there is no difference in the output, then I don't know what is
going on.

Tom
Reply all
Reply to author
Forward
0 new messages