smoqadam / PyFladesk

create desktop application by using Flask and QtWebKit
MIT License
442 stars 67 forks source link

Port 0 #13

Closed patarapolw closed 5 years ago

patarapolw commented 6 years ago

It isn't natively supported in PyFladesk, but I got it working with (according to SO)

import socket

if port == 0:
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.bind(('localhost', 0))
    port = sock.getsockname()[1]
    sock.close()

My full edit of __init__.py.