Spaces:
Build error
Build error
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,7 +1,60 @@
|
|
| 1 |
-
from
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
app =
|
| 4 |
|
| 5 |
-
@app.
|
| 6 |
-
def
|
| 7 |
-
return "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from fastapi.responses import HTMLResponse
|
| 3 |
+
import uvicorn
|
| 4 |
|
| 5 |
+
app = FastAPI()
|
| 6 |
|
| 7 |
+
@app.get("/", response_class=HTMLResponse)
|
| 8 |
+
async def root():
|
| 9 |
+
return """
|
| 10 |
+
<html>
|
| 11 |
+
<head>
|
| 12 |
+
<title>Welcome</title>
|
| 13 |
+
</head>
|
| 14 |
+
<body>
|
| 15 |
+
<h1>Welcome to our website!</h1>
|
| 16 |
+
<p>Please <a href="/login">login</a> or join our <a href="/waitlist">waitlist</a>.</p>
|
| 17 |
+
</body>
|
| 18 |
+
</html>
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
@app.get("/login", response_class=HTMLResponse)
|
| 22 |
+
async def login():
|
| 23 |
+
return """
|
| 24 |
+
<html>
|
| 25 |
+
<head>
|
| 26 |
+
<title>Login</title>
|
| 27 |
+
</head>
|
| 28 |
+
<body>
|
| 29 |
+
<h1>Login</h1>
|
| 30 |
+
<form action="/login" method="post">
|
| 31 |
+
<label for="username">Username:</label>
|
| 32 |
+
<input type="text" id="username" name="username"><br><br>
|
| 33 |
+
<label for="password">Password:</label>
|
| 34 |
+
<input type="password" id="password" name="password"><br><br>
|
| 35 |
+
<input type="submit" value="Submit">
|
| 36 |
+
</form>
|
| 37 |
+
</body>
|
| 38 |
+
</html>
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
@app.get("/waitlist", response_class=HTMLResponse)
|
| 42 |
+
async def waitlist():
|
| 43 |
+
return """
|
| 44 |
+
<html>
|
| 45 |
+
<head>
|
| 46 |
+
<title>Join Waitlist</title>
|
| 47 |
+
</head>
|
| 48 |
+
<body>
|
| 49 |
+
<h1>Join Our Waitlist</h1>
|
| 50 |
+
<form action="/waitlist" method="post">
|
| 51 |
+
<label for="email">Email:</label>
|
| 52 |
+
<input type="email" id="email" name="email"><br><br>
|
| 53 |
+
<input type="submit" value="Join Waitlist">
|
| 54 |
+
</form>
|
| 55 |
+
</body>
|
| 56 |
+
</html>
|
| 57 |
+
"""
|
| 58 |
+
|
| 59 |
+
if __name__ == "__main__":
|
| 60 |
+
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True, debug=True)
|