How to run app from app factory?
See original GitHub issueI try to run the server by command uvicorn my_packege.app:create_app
and got error: TypeError: __call__() missing 1 required positional argument: 'send'
. What could be the reason?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Application Factories — Flask Documentation (2.2.x)
Testing. You can have instances of the application with different settings to test every case. · Multiple instances. Imagine you want to run...
Read more >Demystifying Flask's “Application Factory”
Separating logic between modules means we'd be importing this app object all over the place, eventually leading to problems like circular imports. The...
Read more >How to set up a production-grade flask application using ...
The function where the instantiation of the flask app is defined is called an application factory function (because it is literary used to ......
Read more >Configure Python Flask App to use "create_app" factory and ...
I've started migrating toward using the form of the create_app pattern that Miguel Grinberg introduces in part XV of his Flask Mega-Tutorial ...
Read more >Setting up App Factory - Pega Academy
Once your Pega Platform environments are acquired, it is time to install the App Factory component. Download the installation guide accessible from the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
application factories were added to flask due to the need to not having application creation a side effect of importing modules. It also allows having different versions/configurations of applications existing at the same time, which is great for unit tests. This pattern extends further, in that settings are typically stored as an object on the application itself, rather than statics in a settings module. Different settings can thus be created for different purposes, without having to restart the entire process. I am a bit surprised that this kind of pattern isn’t encouraged and supported by starlette / uvicorn, since it evolved as a response to a need.
flask, aiohttp
Factory need when you need test the app. If you use a global app then you get one app but in unit tests need to create an app for each test.