-
Notifications
You must be signed in to change notification settings - Fork 0
/
wbs.py
38 lines (31 loc) · 1.23 KB
/
wbs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from typing import Optional
from fastapi import FastAPI , Response , status, HTTPException,Request,Form
from fastapi.params import Body
from fastapi.templating import Jinja2Templates
from pydantic import BaseModel
from fastapi.staticfiles import StaticFiles
app = FastAPI()
templates = Jinja2Templates(directory="html")
app.mount("/static", StaticFiles(directory="html"), name="static")
@app.get("/")
def home(request:Request):
return templates.TemplateResponse("Signin.html",{"request": request})
@app.post("/submit")
def login_check(request:Request,username:str=Form(...),password:str=Form(...)):
print(username,password)
return templates.TemplateResponse("index1.html",{"request": request})
@app.get("/register")
async def register(request:Request):
return templates.TemplateResponse("Signup.html",{"request": request})
@app.post("/registration")
def create_post(request:Request,fullname: str=Form(...),
email: str =Form(...),
college : str=Form(...),
domain: str=Form(...),
year: str =Form(...),
dob : str =Form(...),
address : str =Form(...),
username: str =Form(...),
password: str =Form(...),
cpassword: str =Form(...)):
return templates.TemplateResponse("Signin.html",{"request": request})