38 lines
918 B
Markdown
38 lines
918 B
Markdown
# 16 JANVIER
|
|
ctrl r recherche dans historique commande
|
|
uvicorn app:app --reload --host 0.0.0.0 --port 8000
|
|
MVC : Model(Ordinateur, utilisateurs) Vue(Dashboard) Controller(app.py --> /endpoint)
|
|
|
|
##VUE JSON
|
|
---------------------------------
|
|
|
|
On va lier les deux fichiers
|
|
app.py = endpoint
|
|
ordinateur.py
|
|
|
|
Importer Ordinateur.py au app.py
|
|
|
|
transformer la data, on va modifier init dans ordinateur py
|
|
''' = commenter en python un zone de texte
|
|
|
|
ajout data dans app.py
|
|
|
|
deprycated : code qu'on n'utilise plus? en anglais
|
|
|
|
------------------------------
|
|
|
|
Création nouveau route : get dans app.py
|
|
|
|
-------------------------------
|
|
1. activate source
|
|
2. uvicorn
|
|
3. launch grabber
|
|
4. check http://localhost:8000/ordi1
|
|
|
|
----------------------------------
|
|
faire un template html :D
|
|
avec Jinja2 pip install jinja2
|
|
voir site "fastapi jinja2 template"
|
|
|
|
ex: <h2>{{ordi.hostname}}</h2>
|