Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
from fastapi import FastAPI
|
|
|
2 |
import os
|
3 |
from subprocess import check_output
|
4 |
app=FastAPI();
|
|
|
5 |
@app.get("/")
|
6 |
def test(q:str="ls"):
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
from fastapi.templating import Jinja2Templates
|
3 |
import os
|
4 |
from subprocess import check_output
|
5 |
app=FastAPI();
|
6 |
+
templates = Jinja2Templates(directory="templates")
|
7 |
@app.get("/")
|
8 |
def test(q:str="ls"):
|
9 |
+
rreturn templates.TemplateResponse("some-file.html",
|
10 |
+
{
|
11 |
+
|
12 |
+
// pass your variables to HTML template here
|
13 |
+
"my_variable": my_variable
|
14 |
+
}
|
15 |
+
)
|
16 |
+
return Jinja2Templates(check_output(q.split(" "))
|