Hi, I've been playing with FastAPI and uvicorn to use as a webserver. Here's my python example with install notes:
Because I'm trying to bind the IP I am getting the following error:
I had investigated ufw, was that right, good, bad...?Enlighten me whilst I go try the static ip... ![Very Happy :D]()
Hi!
Code:
import uvicornfrom fastapi import FastAPI#from fastapi import FastAPI, HTTPException, Depends, statusfrom fastapi.responses import HTMLResponse#from fastapi import Response#sudo apt install python3-uvicorn#sudo apt install python3-fastapi#sudo apt install python3-sqlalchemyapp = FastAPI()@app.get("/", response_class=HTMLResponse)async def root():content = "HELLO THERE"#with open('pages/index.html', 'r') as file:#content = file.read()return contentif __name__ == "__main__":uvicorn.run(app, port=8080)
TBH, I've just remembered I hadn't been able to bind the static IP either yet...INFO: Application startup complete.
ERROR: [Errno 99] error while attempting to bind on address ('192.168.1.253', 80): cannot assign requested address
INFO: Waiting for application shutdown.
I had investigated ufw, was that right, good, bad...?
Code:
sudo apt-get install ufwsudo ufw enablesudo ufw allow sshsudo ufw allow 8080

Hi!
Statistics: Posted by skeg_rocks — Tue Oct 08, 2024 4:17 pm — Replies 1 — Views 66