Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

simple flask app

# Extremely simple flask application, will display 'Hello World!' on the screen when you run it
# Access it by running it, then going to whatever port its running on (It'll say which port it's running on).
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run()
Comment

Flask demo code

from flask import Flask  
  
app = Flask(__name__) #creating the Flask class object   
 
@app.route('/') #decorator drfines the   
def home():  
    return "hello, this is our first flask website";  
  
if __name__ =='__main__':  
    app.run(debug = True)  
Comment

flask app example

import flask

# A simple Flask App which takes
# a user's name as input and responds
# with "Hello {name}!"

app = flask.Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def index():
    message = ''
    if flask.request.method == 'POST':
        message = 'Hello ' + flask.request.form['name-input'] + '!'
    return flask.render_template('index.html', message=message)

if __name__ == '__main__':
    app.run()
Comment

flask tutorial

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run()
Comment

PREVIOUS NEXT
Code Example
Python :: while loop choosing numbers 
Python :: index operator with if and elif statement in python 
Python :: mkvirtualenv 
Python :: python recase 
Python :: python how to make item assignemnt class 
Python :: python source script custom functions 
Python :: python parameter pack 
Python :: treesitter python languages 
Python :: converting from series to dataframe with tabulate 
Python :: open a tkinter window fullscreen with button 
Python :: "DO_NOTHING" is not defined django 
Python :: counter vectriozer in python 
Python :: python scroll 
Python :: np random choice given distribution 
Python :: dbscan clustering of latitudes and longitudes 
Python :: python scale function 
Python :: append in dictionary with matrix values 
Python :: git ignore everything but python files 
Python :: first hitting time python 
Python :: how to close turle loop 
Python :: def square_odd(pylist) 
Python :: root = tk.Tk() my_gui = App1(root) 
Python :: qtile: latest development version 
Python :: discord.py get channel object from id 
Python :: Can I convert python code to C++? 
Python :: user logout in django rest framework 
Python :: how to accept invalidfileexception in python 
Python :: pandas show all columns 
Python :: pseudo-random input signal python 
Python :: return Response converting to string drf 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =