This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>{{not_defined|default("This is not defined in the Main program")}}</h3> | |
<h3>{{marks|dictsort(by='value')}}</h3> | |
<h3>{{5456151|filesizeformat}}</h3> | |
{{html_format|safe}} | |
<h3>"This is a sample text which will be displayed on the website": {{"This is a sample text which will be displayed on the website"|truncate(20)}}</h3> | |
<h3>"This is a sample text which will be displayed on the website": {{"This is a sample text which will be displayed on the website"|truncate(20, true)}}</h3> | |
<h3>{{"https://github.com/kaustubhgupta"|urlize}}</h3> | |
<h3>"This is a sample text which will be displayed on the website": {{"This is a sample text which will be displayed on the website"|wordcount}}</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>String Type (Upper Function): {{string_.upper()}}</h3> | |
<h3>Integer Type (Arithemtic Function): {{integer + 2}}</h3> | |
<h3>List Type (Slicing): {{skills[1]}}</h3> | |
<h3>Dictionary Type (Get Function): {{dictionary.get('2nd_year')}}</h3> | |
<h3>Class Type (Instance Function): {{class_.getMaxSpeed()}}</h3> | |
<h3>Set Type (Intersection Function): {{set_1.intersection(set_2)}}</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
app = Flask(__name__) | |
class Car: | |
def __init__(self, name: str, engine: str) -> None: | |
self.name = name | |
self.engine = engine | |
def getMaxSpeed(self) -> int: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
app = Flask(__name__) | |
@app.route('/', methods=['GET', 'POST']) | |
def index(): | |
return render_template('new.html', | |
first_name='Kaustubh', | |
last_name="Gupta", | |
article_title="Jinja Template ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/', methods=['GET', 'POST']) | |
def index(): | |
return "Hello" | |
if __name__ == "__main__": | |
app.run(debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>{{title}}</title> | |
</head> | |
<body> | |
{{body_content}} | |
<img src="/static/img1.png"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI, Request | |
from fastapi.templating import Jinja2Templates | |
from fastapi.staticfiles import StaticFiles | |
from fastapi.responses import HTMLResponse | |
import uvicorn | |
app = FastAPI() | |
staticfiles = StaticFiles(directory="demo/toServe") | |
app.mount("/static", staticfiles, name="static") | |
templates = Jinja2Templates(directory="demo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>{{title}}</title> | |
</head> | |
<body> | |
{{body_content}} | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI, Request | |
from fastapi.templating import Jinja2Templates | |
from fastapi.responses import HTMLResponse | |
import uvicorn | |
app = FastAPI() | |
templates = Jinja2Templates(directory="demo") | |
@app.get('/', response_class=HTMLResponse) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
from book import bookroute | |
from novel import novelroute | |
import uvicorn | |
app = FastAPI() | |
app.include_router(bookroute, prefix="/book") | |
app.include_router(novelroute, prefix="/novel") | |