smurfix/flask-script

Using ssl_key & ssl_cert options (instead of ssl_context) throws an error

philfreo opened this issue · 8 comments

According to the code you should be able to pass ssl_key and ssl_crt to Server, instead of building & passing the ssl_context tuple. However because you don't pop these from kwargs an error is caused:

./manage.py runserver
Traceback (most recent call last):
  File "./manage.py", line 902, in <module>
    manager.run()
  File "proj/venv/lib/python2.7/site-packages/flask_script/__init__.py", line 412, in run
    result = self.handle(sys.argv[0], sys.argv[1:])
  File "proj/venv/lib/python2.7/site-packages/flask_script/__init__.py", line 383, in handle
    res = handle(*args, **config)
  File "proj/venv/lib/python2.7/site-packages/flask_script/commands.py", line 425, in __call__
    **self.server_options)
  File "proj/venv/lib/python2.7/site-packages/flask/app.py", line 739, in run
    run_simple(host, port, self, **options)
TypeError: <flask_script.commands.Server object at 0x112a8db50>: run_simple() got an unexpected keyword argument 'ssl_key'

tested with Flask 0.9

Looks like @VladimirPal introduced this in c6604eb which I merged in #138

@VladimirPal do you mind fixing?

@philfreo would you be up for submitting a PR fixing this?

I'd like to cut a new release soon, and be nice to have this fixed. Afraid I don't have time though to fix this issue (I barely have time to get a release out unfortunately).

@jeffwidman, @philfreo have one of you fixed this thing?

Nope, I have been using gunicorn instead of runserver.

@philfreo any chance you have a test, as i can't reproduce this with latest flask.

> cat test_manager.py
#!/usr/bin/env python
from flask_script import Manager, Server

from app import app

manager = Manager(app)
manager.add_command("runserver", Server(host="::",
                                        port="1234",
                                        ssl_crt="cert.pem", ssl_key="key.pem"))

if __name__ == "__main__":
    manager.run()
> ./test_manager.py runserver
Enter PEM pass phrase:
 * Running on https://[::]:1234/ (Press CTRL+C to quit)

Nope, I'm not using this anymore. I was using Flask 0.9 when I opened this.

@jeffwidman any ideas on this? For me everything is working as it should

No, I had closed as a "can't repro", then thought better of it as I hadn't taken the time to play with it. If you tried and it's all working as expected then let's close it.