Upload files to "/"
This commit is contained in:
parent
599fc3e187
commit
4ce9da671b
43
2026-02-12.md
Normal file
43
2026-02-12.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
[Jeudi 12 Février 2026]
|
||||||
|
class Employee
|
||||||
|
ManytoMany
|
||||||
|
delete ordi
|
||||||
|
Formulaire de création d'employee
|
||||||
|
|
||||||
|
forms.py
|
||||||
|
|
||||||
|
faire tableau intermédiaire -> relier employees et ordis
|
||||||
|
#
|
||||||
|
1. [Commande du jour]
|
||||||
|
|
||||||
|
ligne 3 from models import Hero, Ordinateur, Employee
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/add_employee")
|
||||||
|
async def add_employee_form(request: Req):
|
||||||
|
return templates.TemplateResponse("add_employee.html", {"request": request})
|
||||||
|
|
||||||
|
from fastapi.responses import HTMLResponse, RedirectResponse
|
||||||
|
from starlette.staticfiles import StaticFiles
|
||||||
|
from sqlmodel import create_engine, SQLModel, Session, select
|
||||||
|
|
||||||
|
ligne 131
|
||||||
|
@app.post("/add_employee")
|
||||||
|
async def add_employee(request: Req):
|
||||||
|
form_data = await request.form()
|
||||||
|
first_name = form_data.get("first_name")
|
||||||
|
family_name = form_data.get("family_name")
|
||||||
|
|
||||||
|
if not first_name or not family_name:
|
||||||
|
raise HTTPException(status_code=400, detail="Prénom et nom de famille requis")
|
||||||
|
|
||||||
|
with Session(engine) as session:
|
||||||
|
employee = Employee(first_name=first_name, family_name=family_name)
|
||||||
|
session.add(employee)
|
||||||
|
session.commit()
|
||||||
|
session.refresh(employee)
|
||||||
|
|
||||||
|
return {"status": "success", "message": f"Employé {first_name} {family_name} ajouté avec succès", "employee_id": employee.id}
|
||||||
|
|
||||||
|
|
||||||
|
ligne 150 return RedirectResponse(url="/", status_code=303)
|
||||||
7
2026-02-13 js.md
Normal file
7
2026-02-13 js.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[Vendredi 13 Février 2026]
|
||||||
|
|
||||||
|
# docker run --rm --network host -v $(pwd):/app -w /app node:current-alpine3.23 node docker-compose-cli.js {FICHIER} {ACTION} {PARAMS}
|
||||||
|
|
||||||
|
1. [Commande du jour]
|
||||||
|
|
||||||
|
docker-compose
|
||||||
32
2026-02-17 CMS.md
Normal file
32
2026-02-17 CMS.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[Mardi 17 Février 2026]
|
||||||
|
|
||||||
|
# serveur local
|
||||||
|
|
||||||
|
1. [Commande du jour]
|
||||||
|
|
||||||
|
CMS : Content Management System (sgc en français)
|
||||||
|
|
||||||
|
css -> bootstrap 5
|
||||||
|
|
||||||
|
BDD -> SQL
|
||||||
|
|
||||||
|
nginx et apache, serveur distant gratuit
|
||||||
|
|
||||||
|
HTTPS -> TCP/IP
|
||||||
|
FTP = File Transfer Protocol
|
||||||
|
|
||||||
|
adresses web (URL)
|
||||||
|
http(s) SSL (secure socket layer)
|
||||||
|
www.domaine. (extention TLD)
|
||||||
|
|
||||||
|
wordpress
|
||||||
|
aethiqvortem
|
||||||
|
I5d8$S7@@@99+p
|
||||||
|
|
||||||
|
(marche proba pas)
|
||||||
|
pierre
|
||||||
|
I5d8$S7@@@99+p5
|
||||||
|
|
||||||
|
php
|
||||||
|
pierre
|
||||||
|
vJ@2Vq&@5G
|
||||||
11
2026-02-19 CMS.md
Normal file
11
2026-02-19 CMS.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Jeudi 19 Février 2026]
|
||||||
|
|
||||||
|
# serveur local
|
||||||
|
|
||||||
|
1. [Commande du jour]
|
||||||
|
|
||||||
|
<?phpNOMVARIABLE();?>
|
||||||
|
<variable> </ >
|
||||||
|
variable { }
|
||||||
|
|
||||||
|
utiliser bootstrap (framework) et pas de css
|
||||||
63
2026-02-25.md
Normal file
63
2026-02-25.md
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
[Mercredi 25 Février 2026]
|
||||||
|
|
||||||
|
# génération de clé SSH privée/publique - Certificat pour appli python
|
||||||
|
demain dockerisation de l'appli avec tout les paramètres
|
||||||
|
|
||||||
|
1. [Commande du jour]
|
||||||
|
|
||||||
|
|
||||||
|
clé privée
|
||||||
|
clé publique
|
||||||
|
|
||||||
|
install openssh-server
|
||||||
|
install locate
|
||||||
|
|
||||||
|
maxtries
|
||||||
|
fail2ban
|
||||||
|
#Port
|
||||||
|
#PermitRootLogin prohibit-password
|
||||||
|
|
||||||
|
<sudo nano /etc/ssh/sshd_config> (sans les<>)
|
||||||
|
|
||||||
|
# To disable tunneled clear text passwords, change to "no" here!
|
||||||
|
PasswordAuthentication no (de base oui commenté)
|
||||||
|
#PermitEmptyPasswords no
|
||||||
|
|
||||||
|
#AllowAgentForwarding yes
|
||||||
|
#AllowTcpForwarding yes
|
||||||
|
#GatewayPorts no
|
||||||
|
X11Forwarding no (par défaut oui -> interface graphique)
|
||||||
|
#X11DisplayOffset 10
|
||||||
|
#X11UseLocalhost yes
|
||||||
|
#PermitTTY yes
|
||||||
|
PrintMotd no
|
||||||
|
#PrintLastLog yes
|
||||||
|
#TCPKeepAlive yes
|
||||||
|
#PermitUserEnvironment no
|
||||||
|
#Compression delayed
|
||||||
|
#ClientAliveInterval 0
|
||||||
|
#ClientAliveCountMax 3
|
||||||
|
#UseDNS no
|
||||||
|
#PidFile /run/sshd.pid
|
||||||
|
#MaxStartups 10:30:100
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#SSH
|
||||||
|
(-X affiche le display du pc qui recoit la connection)
|
||||||
|
ssh -X !USER@ip.ip.ipp.ip -p mettreportici
|
||||||
|
|
||||||
|
openssl req -x509 -newkey rsa:4096 \
|
||||||
|
-keyout key.pem \
|
||||||
|
-out cert.pem \
|
||||||
|
-days 365 \
|
||||||
|
-nodes
|
||||||
|
|
||||||
|
|
||||||
|
uvicorn app:app --host 0.0.0.0 --port 8000 --ssl-keyfile /home/pierre19/.ssh/key.pem --ssl-certfile /home/pierre19/.ssh/cert.pem
|
||||||
|
|
||||||
|
Let's encrypt (certificat de connexion gratuit jusqu'a une quantité de connexion)
|
||||||
|
généralement payant
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user