Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
511 views
in Technique[技术] by (71.8m points)

python - how to build uWSGI with SSL support to use the websocket handshake API function?

What I have: ubuntu 14.4 uwsgi running with flask (python) with nginx as reverse proxy.

What I want: running this example of WebSockets: https://github.com/zeekay/flask-uwsgi-websocket/blob/master/examples/echo/echo.py

When I'm running this application with chromepy on port 5000, it is working fine but when I try to run without chromepy I get an error

The error:

Thu Jun 12 12:58:24 2014 - you need to build uWSGI with SSL support to use the websocket handshake api function !!!
Traceback (most recent call last):
  File "/home/lab_alglab/rep/car/local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/lab_alglab/rep/car/local/lib/python2.7/site-packages/flask_uwsgi_websocket/websocket.py", line 54, in __call__
    uwsgi.websocket_handshake(environ['HTTP_SEC_WEBSOCKET_KEY'], environ.get('HTTP_ORIGIN', ''))
IOError: unable to complete websocket handshake
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had to install OpenSSL via brew. Then run this command.

CFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib" UWSGI_PROFILE_OVERRIDE=ssl=true pip install uwsgi -Iv

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...