Skip to content

Commit f1b14bb

Browse files
committed
Update the reload filter
1 parent 682776e commit f1b14bb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

backend/cli.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
from backend.utils.file_ops import install_git_plugin, install_zip_plugin, parse_sql_script
2424

2525

26+
class CustomReloadFilter(PythonFilter):
27+
"""自定义重载过滤器"""
28+
29+
def __init__(self):
30+
super().__init__(extra_extensions=['.json', '.yaml', '.yml'])
31+
32+
2633
def run(host: str, port: int, reload: bool, workers: int | None) -> None:
2734
url = f'http://{host}:{port}'
2835
docs_url = url + settings.FASTAPI_DOCS_URL
@@ -45,9 +52,7 @@ def run(host: str, port: int, reload: bool, workers: int | None) -> None:
4552
address=host,
4653
port=port,
4754
reload=not reload,
48-
# https://github.com/emmett-framework/granian/issues/659
49-
# reload_filter=PythonFilter(extra_extensions=['.json', '.yaml', '.yml']),
50-
reload_filter=PythonFilter,
55+
reload_filter=CustomReloadFilter,
5156
workers=workers or 1,
5257
).serve()
5358

0 commit comments

Comments
 (0)