Coverage for pyquickhelper/cli/uvicorn_cli.py: 29%

7 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-03 02:21 +0200

1""" 

2@file 

3@brief Simplified function versions. 

4""" 

5import os 

6 

7 

8def uvicorn_app(path="dummy_db.db3", pwd="dummy", port=8798, host="127.0.0.1"): 

9 """ 

10 Runs a uvicorn application. It should be used for testing 

11 not for production. Use ``host:post/redoc`` or 

12 ``host:post/docs`` to get a web page in order to 

13 submit files. 

14 

15 :param path: filename for the databse 

16 :param pwd: password 

17 :param host: host 

18 :param port: port 

19 

20 .. cmdref:: 

21 :title: Runs a uvicorn application 

22 :cmd: -m pyquickhelper uvicorn_app --help 

23 

24 Runs a uvicorn application. 

25 """ 

26 from ..server.filestore_fastapi import create_app # pylint: disable=W0611 

27 import uvicorn 

28 os.environ['PYQUICKHELPER_FASTAPI_PWD'] = pwd 

29 os.environ['PYQUICKHELPER_FASTAPI_PATH'] = path 

30 uvicorn.run("pyquickhelper.server.filestore_fastapi:create_app", 

31 host=host, port=port, log_level="info", factory=True)