Skip to content
Snippets Groups Projects
Commit 0fba03c8 authored by ANTO SAGAYA JUSTIN R's avatar ANTO SAGAYA JUSTIN R :speech_balloon:
Browse files

Viewer and jinja

parent 76ef4f2d
No related branches found
No related tags found
No related merge requests found
......@@ -14,4 +14,10 @@ python strip function:
Flask redirect package:
This is a basic illustration of redirection in Flask.
You can redirect to any route within your Flask application using the redirect() function.
combined with url_for() to specify the route's endpoint.
\ No newline at end of file
combined with url_for() to specify the route's endpoint.
vs code shortcuts:
Alt+up arow = move line.
ctl+shift+enter = empty line for befor line.
ctl+L = select one line.
\ No newline at end of file
from flask import Flask
from flask import Flask , render_template
app = Flask(__name__)
import os
import math
......@@ -6,20 +7,21 @@ basename = '/iotcloud'
# app.debug = True ( for any debug error for True that line )
# @app.route
# 1.To Searching route ex:[172.30.0.231:7000/hello] to view your flask project.
@app.route('/hello')
@app.route(basename+'/hello')
def hello_world():
return "<h1>Hello World 123<h1/>"
@app.route('/')
def hello():
return "<h1>Hello Justin Welcome<h1/>"
d = {
"username": "justin",
"env": "labs",
"avatar": "https://media.licdn.com/dms/image/D5603AQGqSYfbrnkjcw/profile-displayphoto-shrink_200_200/0/1694890248719?e=1720051200&v=beta&t=M6ZsyUoBIQ8fpaswZe6aCld0oOmrala4dKPRt2m4v98"
}
return render_template('helloworld.html', data = d)
@app.route('/whoami')
@app.route(basename + '/whoami')
def whoami():
return "<h1>"+os.popen('whoami').read()+"<h1/>"
return "<h1>" + os.popen('whoami').read() + "<h1/>"
# @app.route:
# 1.To Searching route ex:[172.30.0.231:7000/iotcloud/whoami] to view your flask project.
# whoami:
# Lhis Linux Command To Return This System Username For Example [ justinmass2001 ].
......@@ -67,4 +69,5 @@ def power ( a , b ):
if __name__ == '__main__':
app.run(host = '0.0.0.0' , port = '7000' , debug = True )
# host = '0.0.0.0':
# your access all type of IP address to add [host = '0.0.0.0'] Running on all IP addresses
\ No newline at end of file
# your access all type of IP address to add [host = '0.0.0.0'] Running on all IP addresses
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment