My generated swagger_server works great when started with:
python3 -m swagger_server
The problem starts when I want to get the UID of the client certificate when using dual side TLS authentication. Dual side TLS authentication worked well but I did not find out how to grab the UID from the certificate sent to my server.
I started to look at nginx and uWSGI to get the job done.
The problem is that I cannot find the syntax for making the wsgi.py call the swagger_server as it has been built as a module.
So I am looking for some help to write the wsgi.py:
from myproject import application
if __name__ == "__main__":
application.run()
My swagger_server/__main__.py looks like this:
#!/usr/bin/env python3
import connexion
from .encoder import JSONEncoder
app = connexion.App(__name__, specification_dir='swagger/')
app.app.json_encoder = JSONEncoder
app.add_api('swagger.yaml', arguments={'title': 'My Service'})
application = app.app
if __name__ == '__main__':
app.run(host='localhost')
So I assume that I should be able to create a wsgi.py file to start my server somehow. So far all my experiments to import swagger_server properly have failed.
from .swagger_server import application
if __name__ == "__main__":
application.run()
This produces just
Traceback (most recent call last):
File "wsgi.py", line 9, in <module>
from .swagger_server import application
SystemError: Parent module '' not loaded, cannot perform relative import