What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-17 23:14:11
<script src="{{ url_for('static', filename='scripts.js') }}"></script>
import flask app = flask.Flask(__name__) with app.test_request_context(): print(flask.url_for("static", filename="index.css"))Output/static/index.css Input Filesstatic/index.css 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-13 02:41:10
flask heroku
If u get "No web processes running" Error, Make Sure: 1. your main file is 'app.py' and your main func is app [ app = Flask(__name__), app.run() ] 2. you added gunicorn==20.1.0 to your requirements.txt file 3. you have Procfile with the fo... 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 -
Python 2021-11-05 11:34:08
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__) @a... Add solution