amisadmin / fastapi-amis-admin

FastAPI-Amis-Admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by django-admin, and has as many powerful functions as django-admin.

Home Page:http://docs.amis.work

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pywebview集成

wanghaisheng opened this issue · comments

有人探索https://github.com/r0x0r/pywebview

或者说直接用pyinstaller打包成exe?

我也在研究做desktop application的方案

用多进程后台运行app就行了,以下代码在官方demo backend文件夹下测试成功:

import webview
from multiprocessing import Process, Queue


def run_app(q):
    from main import app
    import uvicorn

    @app.on_event('startup')
    def put_signal():
        q.put('started')
    uvicorn.run(app)


def init(win, q):
    q.get()
    win.load_url('http://127.0.0.1:8000')


if __name__ == '__main__':
    q = Queue()
    p = Process(target=run_app, args=(q,))
    p.start()
    win = webview.create_window('amis', html='<h1>加载中...</h1>')

    webview.start(init, (win, q), gui='cef', debug=False)
    p.terminate()
commented

谢谢

支持pyinstaller打包,注意相关库的翻译文件和部分静态资源。

@amisadmin 去年没折腾成功 这两天又开始把玩了 我想搭一个 桌面 bs双端的saas mvp