Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On using flask-talisman with application factory pattern #71

Open
lahdjirayhan opened this issue Mar 20, 2021 · 1 comment
Open

On using flask-talisman with application factory pattern #71

lahdjirayhan opened this issue Mar 20, 2021 · 1 comment

Comments

@lahdjirayhan
Copy link

I tried the following in my app.py:

from flask_talisman import Talisman
from flask_main import create_app

app = create_app()
Talisman(app)

if __name__ == "main":
    app.run()

It still does not work. Any request coming to https:// returns SSL_ERROR_RX_RECORD_TOO_LONG. I've tried both commands to start the app: flask run and python app.py, nothing changes.

Per this issue #66, doing this in create_app won't work.

from flask import Flask
from flask_talisman import Talisman
from flask_main.configuration import Configuration

talisman = Talisman()

def create_app():
    app = Flask(__name__)
    app.config.from_object(Configuration)
    talisman.init_app(app)

Is there any way to make flask-talisman work with application factory pattern?

@sbutler44
Copy link

I'm using an application factory, and it is working well with the code you've used above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants