What do you want to save?
Add Code snippet
New code examples
-
Python 2021-09-28 20:12:02
flask mongoengine configuration
'''Basic setup can be done by defining MONGODB_SETTINGS on app.config and creating a MongoEngine instance.''' from flask import Flask from flask_mongoengine import MongoEngine app = Flask(__name__) app.config['MONGODB_SETTINGS'] = { "db": &... Add solution -
Python 2021-09-16 05:35:02
python simple web app
# Core web app using flask # Download flask if you haven't from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' if __name__ == '__main__': app.run() # If you want to put this on the internet, u... Add solution -
Python 2021-09-14 02:29:02
flask app with spark
from pyspark import SparkContext sc = SparkContext('local') from flask import Flask, request app = Flask(__name__) @app.route('/whateverYouWant', methods=['POST']) #can set first param to '/' def toyFunction(): posted_data = sc.parallelize([reques... Add solution -
Python 2021-09-04 14:48:02
how to redirect to another page in python
from flask import Flask, redirect, request app = Flask(__name__) from urllib.parse import urlparse, urlunparse FROM_DOMAIN = "yourusername.pythonanywhere.com" TO_DOMAIN = "www.yourdomain.com" @app.before_request def redirect_to_new... Add solution -
Python 2021-09-02 10:28:02
flask tutorial
# 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 2021-09-01 08:04:02
creating an apis with python and flask
from flask import Flask from flask_restful import Resource, Api app = Flask(__name__) api = Api(app) class HelloWorld(Resource): def get(self): return {'hello': 'world'} api.add_resource(HelloWorld, '/') if __name__ == '__main__': app.... Add solution -
Python 2021-08-30 18:40:02
python web app
# Core web app using flask # Download flask if you haven't from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' if __name__ == '__main__': app.run() # If you want to put this on the internet, u... Add solution