Pyue first project
First of all, we should generate project tree.
Use pyue cmd tool for that:
Now you can see project structure like that:
controllersfolder should be used to store API handlersmain.pyfile is entrypoint for your web apppagesfolder should be used to store Pyue componentsstaticfolder stores images, libs and other static filestemplatesfolder stores html/templates, generated by Pyue
If you look in main.py you will see an example like that:
from pyue import Pyue, BackendType, Page
from flask import Flask
# Describing page
p = Page(title="My Site")
# Creating Pyue app
app = Pyue(BackendType.Flask)
# Register page like that:
app.add_page(page=p, url="/")
f = Flask(__name__)
app.mount(f)
f.run()
As you can see:
Pageis used to define web pagesPyueis main point for web UI at allPyue.add_page(...)registers yourPagecomponentsPyue.mount(...)registers itself in backend (ex. Flask)
To start our web app we must run main.py: