What do you want to save?
Add Code snippet
New code examples
-
Python 2022-01-29 21:21:15
flask example
# 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__) @a... Add solution -
Python 2022-01-22 21:56:03
telegram bot python
import re from flask import Flask, request import telegram from telebot.credentials import bot_token, bot_user_name,URL global bot global TOKEN TOKEN = bot_token bot = telegram.Bot(token=TOKEN) app = Flask(__name__) @app.route('/{}'.format(TOKEN), met... Add solution -
Python 2021-11-18 11:17:29
how to run flask in another thread in python
from flask import * from threading import Thread app = Flask(__name__) @app.route("/", methods=["POST", "GET"]) def home(): return render_template("index.html") if __name__ == "__main__": app.run(deb... Add solution -
Python 2021-11-17 17:21:24
flask make static directory
from flask import Flask, send_from_directory app = Flask(__name__) @app.route("/static/<path:path>") def static_dir(path): return send_from_directory("static", path) if __name__ == "__main__": app.run() Add solution -
SQL 2021-11-16 07:01:28
flask mysql
from flask import Flask, render_template, request from flask_mysqldb import MySQL app = Flask(__name__) app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_USER'] = 'root' app.config['MYSQL_PASSWORD'] = 'root' app.config['MYSQL_DB'] = 'MyDB' mysql... Add solution -
Python 2021-11-15 06:40:11
flask cors policy no 'access-control-allow-origin'
# initialization app = Flask(__name__) app.config['SECRET_KEY'] = 'the quick brown fox jumps over the lazy dog' app.config['CORS_HEADERS'] = 'Content-Type' cors = CORS(app, resources={r"/foo": {"origins": "http://localhost:port... Add solution -
Python 2021-11-13 16:26:21
how to make a flask server in python
# This is the code # Find me on discord ZDev1#4511 # We shouldn't install flask in the terminal, it is already imported from flask import Flask app = Flask(__name__) # route @app.route('/') # route function def home(): # send 'hey!' return 'hey!' #... Add solution -
Python 2021-11-09 21:13:22
jwt authentication python flask
from flask import Flask from flask_jwt import JWT, jwt_required, current_identity from werkzeug.security import safe_str_cmp class User(object): def __init__(self, id, username, password): self.id = id self.username = username ... Add solution