Snippets Collections

export FLASK_ENV=development                         

export FLASK_ENV=production 

FLASK_APP=hello.py flask run






If you have installed many dependencies in your system and you need requirements.txt for a specific project, you can install first pipreqs:

$ pip install pipreqs

and execute the below command under the project folder.

$ pipreqs

This command will generate requirements.txt file for the particular project.
from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"
from flask import Flask,render_template,request, redirect
 
 
app = Flask(__name__)
app.config['SECRET_KEY'] = 'dajdsjas'
 
 
@app.route('/home')
def home():
    return 'Home page'
 
 
 
@app.route('/take_parameter', methods = ["POST"])
def takeparam():
    try:
        pas = request.args(silent=True)
        #app.logger.info(json)
        return 'OK'
    except:
        return 'INTERNAL ERROR', 500
    
 
@app.route('/take_json', methods = ["POST"])
def takejson():
    try:
        pas = request.get_json(silent=True)
        #app.logger.info(json)
        return 'OK'
    except:
        return 'INTERNAL ERROR', 500
    
if __name__ =='__main__':
    app.run(debug=True)
 
star

Sun Jun 27 2021 14:09:50 GMT+0000 (UTC) https://stackoverflow.com/questions/31252791/flask-importerror-no-module-named-flask

#python #flask
star

Sun Jun 27 2021 14:09:38 GMT+0000 (UTC) https://stackoverflow.com/questions/31252791/flask-importerror-no-module-named-flask

#python #flask
star

Thu Oct 22 2020 09:00:37 GMT+0000 (UTC)

#python #flask
star

Wed May 13 2020 18:55:25 GMT+0000 (UTC) https://www.youtube.com/watch?v=zdgYw-3tzfI

#flask

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension