mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 13:12:24 +00:00
* Update the ruff rules and format the code * Update the per-file-ignores * Update the ci * Update rules * Fix codes * Fix pagination * Update rules
23 lines
565 B
Python
23 lines
565 B
Python
from fastapi import Request
|
|
|
|
from backend.common.exception import errors
|
|
from backend.core.conf import settings
|
|
|
|
|
|
async def demo_site(request: Request) -> None: # noqa: RUF029
|
|
"""
|
|
演示站点
|
|
|
|
:param request: FastAPI 请求对象
|
|
:return:
|
|
"""
|
|
method = request.method
|
|
path = request.url.path
|
|
if (
|
|
settings.DEMO_MODE
|
|
and method != 'GET'
|
|
and method != 'OPTIONS'
|
|
and (method, path) not in settings.DEMO_MODE_EXCLUDE
|
|
):
|
|
raise errors.ForbiddenError(msg='演示环境下禁止执行此操作')
|