fastapi-amis-admin icon indicating copy to clipboard operation
fastapi-amis-admin copied to clipboard

faa 新建项目失败,0.7.3 无法跑fastapi-user-auth-demo

Open yorkane opened this issue 8 months ago • 3 comments

Image

Image

{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"servers":[{"url":"/admin"}],"paths":{"/":{"post":{"summary":"Route","operationId":"route__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseAmisApiOut"}}}}}}},"/page/home":{"post":{"tags":["page"],"summary":"Route","operationId":"route_page_home_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseAmisApiOut"}}}}}}},"/APIDocsApp/":{"post":{"tags":["APIDocsApp"],"summary":"Route","operationId":"route_APIDocsApp__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseAmisApiOut"}}}}}}},"/file/upload":{"post":{"tags":["file"],"summary":"File Upload","operationId":"file_upload_file_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_file_upload_file_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseApiOut_UploadOutSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/demo/":{"post":{"tags":["demo"],"summary":"Route","operationId":"route_demo__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseAmisApiOut"}}}}}}}},"components":{"schemas":{"BaseAmisApiOut":{"properties":{"status":{"type":"integer","title":"Status","default":0},"msg":{"type":"string","title":"Msg","default":""},"data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Data"}},"additionalProperties":true,"type":"object","title":"BaseAmisApiOut","description":"api interface output data format"},"BaseApiOut_UploadOutSchema_":{"properties":{"status":{"type":"integer","title":"Status","default":0},"msg":{"type":"string","title":"Msg","default":"success"},"data":{"anyOf":[{"$ref":"#/components/schemas/UploadOutSchema"},{"type":"null"}]},"code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Code"}},"additionalProperties":true,"type":"object","title":"BaseApiOut[FileAdmin.UploadOutSchema]"},"Body_file_upload_file_upload_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_file_upload_file_upload_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"UploadOutSchema":{"properties":{"filename":{"type":"string","title":"Filename"},"url":{"type":"string","title":"Url"}},"type":"object","title":"UploadOutSchema"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}

0.7.3 版本使用 python3.10 python3.13 均失败,将 https://github.com/amisadmin/fastapi-user-auth-demo 中的app 复制到faa 创建的项目中无法启动。

faa 直接在 demo 中启动后没有菜单:

Image

yorkane avatar Apr 04 '25 17:04 yorkane

直接 qdm run run 启动:

/code/fastapi-user-auth-demo$ pdm run run
WARNING: The following problems are found in your project:
  deprecated-cross-platform: Lock strategy `cross_platform` has been deprecated in favor of lock targets.
Run pdm fix to fix all or pdm fix <name> to fix individual problem.
INFO:     Will watch for changes in these directories: ['/mnt/d/code/fastapi-user-auth-demo/backend']
INFO:     Uvicorn running on http://0.0.0.0:3006 (Press CTRL+C to quit)
INFO:     Started reloader process [2375064] using StatReload
INFO:     Started server process [2375086]
INFO:     Waiting for application startup.
Run time of job "date_task_test (trigger: date[2022-11-11 01:01:01 CST], next run at: 2022-11-11 01:01:01 CST)" was missed by 876 days, 0:05:14.140240
INFO:     Application startup complete.
Run time of job "date_task_test (trigger: date[2022-11-11 01:02:03 CST], next run at: 2022-11-11 01:02:03 CST)" was missed by 876 days, 0:04:12.140707
INFO:     192.168.1.11:6018 - "GET / HTTP/1.1" 200 OK

Image

pdm fix 之后依然没有效果

yorkane avatar Apr 04 '25 17:04 yorkane

换了windows 环境,依然有问题

  File "D:\code\amis_admin\gb\backend\main.py", line 17, in <module>
    blog.setup(app.router,site)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "D:\code\amis_admin\gb\backend\apps\blog\__init__.py", line 7, in setup
    from . import admin, apis, jobs
  File "D:\code\amis_admin\gb\backend\apps\blog\apis.py", line 5, in <module>
    from fastapi_user_auth.globals.deps import CurrentUser
  File "D:\v313\Lib\site-packages\fastapi_user_auth\globals\deps.py", line 10, in <module>
    get_user_or_none = g.auth.get_current_user
                       ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_current_user'

yorkane avatar Apr 05 '25 15:04 yorkane

Image

Image

{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"servers":[{"url":"/admin"}],"paths":{"/":{"post":{"summary":"Route","operationId":"route__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseAmisApiOut"}}}}}}},"/page/home":{"post":{"tags":["page"],"summary":"Route","operationId":"route_page_home_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseAmisApiOut"}}}}}}},"/APIDocsApp/":{"post":{"tags":["APIDocsApp"],"summary":"Route","operationId":"route_APIDocsApp__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseAmisApiOut"}}}}}}},"/file/upload":{"post":{"tags":["file"],"summary":"File Upload","operationId":"file_upload_file_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_file_upload_file_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseApiOut_UploadOutSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/demo/":{"post":{"tags":["demo"],"summary":"Route","operationId":"route_demo__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseAmisApiOut"}}}}}}}},"components":{"schemas":{"BaseAmisApiOut":{"properties":{"status":{"type":"integer","title":"Status","default":0},"msg":{"type":"string","title":"Msg","default":""},"data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Data"}},"additionalProperties":true,"type":"object","title":"BaseAmisApiOut","description":"api interface output data format"},"BaseApiOut_UploadOutSchema_":{"properties":{"status":{"type":"integer","title":"Status","default":0},"msg":{"type":"string","title":"Msg","default":"success"},"data":{"anyOf":[{"$ref":"#/components/schemas/UploadOutSchema"},{"type":"null"}]},"code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Code"}},"additionalProperties":true,"type":"object","title":"BaseApiOut[FileAdmin.UploadOutSchema]"},"Body_file_upload_file_upload_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_file_upload_file_upload_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"UploadOutSchema":{"properties":{"filename":{"type":"string","title":"Filename"},"url":{"type":"string","title":"Url"}},"type":"object","title":"UploadOutSchema"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}} 0.7.3 版本使用 python3.10 python3.13 均失败,将 https://github.com/amisadmin/fastapi-user-auth-demo 中的app 复制到faa 创建的项目中无法启动。

faa 直接在 demo 中启动后没有菜单:

Image

用root登录,admin没权限

JiangJohnny avatar May 25 '25 13:05 JiangJohnny