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
program fall on FlaskInjector(app=app, injector=injector) #65
Comments
Something similar also happens for me with |
This commit fixes it: b57e5e0 It is fixed in master branch but not released yet. |
I’m having the same issue when using FlaskInjector. Had to downgrade both Flask and Werkzeug versions to below 2.0 to make it work. |
@clementta-tagheuer, huge thanks for fixing the issue. |
Hi @evgenyk-storexray, unfortunately I can't do releases for this project. Meanwhile, I suggest you force Flask to 1.1.4 in your project, or drop Flask Injector dependance. |
Thanks, @clementta-tagheuer hopefully, one of them will be here soon. lol |
@alecthomas , @jstasiak any updates on when the above bugfix could be released? |
Same, blocker for us since we won't downgrade Flask. |
This project doesn't work with Flask 2 yet. I'm afraid there'll be no releases until #66 is resolved (and I have no time to work on it). |
Any update on this? |
@alecthomas , @jstasiak please release the latest version. It's a real blocker. |
I don't think there's anything to release, but please show a minimal, complete piece of code (together with the versions of Python, Flask, Werkzeug and any other relevant packages) that fails on the last released version but works with the master branch and I'll reconsider. |
Hi! I just hit this issue, but only on Windows. It works fine on macOS for me. Here is a very small example that reproduces the issue on my end:
|
@nielspedersen Thanks, two bits missing still: what Python and Werkzeug versions? |
Sorry for the missing details - I missed that.
So python 3.7.9 and Werkzeug 2.0.1 |
@nielspedersen Thank you for the update, all the information needed is there and I can reproduce the issue. I'll release something shortly. |
This is fixed in 0.13.0. Thank you everyone for the information. |
I still get this in Flask-Injector==0.13.0 env:
|
Please provide the Flask and Python versions you're using and what error exactly are you getting (with full stack trace) |
Python 3.9
|
I will move to flask 1.1.2 to temporarily avoid the issue |
Any update on this issue ? still reproducing on 0.13.0...not sure how it got closed. |
Resolved in Flask-Injector 0.14.0. |
I have Flask app with flask-injector with creat function.
def create_app(testing: bool = False) -> Flask: app = Flask(__name__) config_app(app, testing) db.init_app(app) migrate.init_app(app, db) router.init_app(app) CORS(app) # Setup injector injector = Injector([AppModule(app.config)]) FlaskInjector(app=app, injector=injector) return app
when i start app (flask run) i get error:
` Traceback (most recent call last):
File "C:\Users\tmv28\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\tmv28\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\tmv28\Documents\Andrey\test\backend\venv\Scripts\flask.exe_main.py", line 7, in
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask\cli.py", line 967, in main
cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask\cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\click\core.py", line 1059, in main
rv = self.invoke(ctx)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\click\core.py", line 1665, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\click\core.py", line 1401, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\click\core.py", line 767, in invoke
return __callback(*args, **kwargs)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\click\decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\click\core.py", line 767, in invoke
return __callback(*args, **kwargs)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask\cli.py", line 848, in run_command
app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask\cli.py", line 305, in init
self.load_unlocked()
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask\cli.py", line 330, in load_unlocked
self.app = rv = self.loader()
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask\cli.py", line 388, in load_app
app = locate_app(self, import_name, name)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask\cli.py", line 240, in locate_app
import(module_name)
File "C:\Users\tmv28\Documents\Andrey\test\backend\main\server.py", line 4, in
app = create_instance()
File "C:\Users\tmv28\Documents\Andrey\test\backend\main\apps\server_init.py", line 22, in create_instance
return create_app(kwargs.get('testing', False))
File "C:\Users\tmv28\Documents\Andrey\test\backend\main\apps\server\factory.py", line 41, in create_app
FlaskInjector(app=app, injector=injector)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask_injector_init.py", line 327, in init
process_dict(container, injector)
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask_injector_init.py", line 379, in process_dict
elif hasattr(value, 'call'):
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\werkzeug\local.py", line 422, in get
obj = instance._get_current_object()
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\werkzeug\local.py", line 544, in _get_current_object
return self.__local() # type: ignore
File "c:\users\tmv28\documents\andrey\test\backend\venv\lib\site-packages\flask\globals.py", line 38, in _lookup_req_object
raise RuntimeError(_request_ctx_err_msg)
RuntimeError: Working outside of request context.
This typically means that you attempted to use functionality that needed
an active HTTP request. Consult the documentation on testing for
information about how to avoid this problem.
`
what did i wrong?
The text was updated successfully, but these errors were encountered: