我想在 Starlette 中使用 piccolo_admin 创建一个管理页面,但出现空字节错误,请帮助我:
Traceback (most recent call last):
File "admin.py", line 4, in <module>
from piccolo_admin.endpoints import create_admin
ValueError: source code string cannot contain null bytes
我的代码:
from starlette.applications import Starlette
from starlette.routing import Mount
import uvicorn
from piccolo_admin.endpoints import create_admin
from db_booker.tables import *
admin = create_admin(tables=[Admins, Users, Books, Titles],
site_name = "Avicenna Admin")
app = Starlette(routes=[Mount("/admin/", admin)])
if __name__ == '__main__':
uvicorn.run(app)