39 lines
859 B
Python
39 lines
859 B
Python
import jsonify as jsonify
|
|
from flask import Flask
|
|
from flask_pymongo import PyMongo
|
|
|
|
# make sure mongoDB (container) is running and accessible
|
|
|
|
# see https://flask-pymongo.readthedocs.io/en/latest/
|
|
|
|
app = Flask(__name__)
|
|
#app.config["MONGO_URI"] = "mongodb://localhost:27017/myDatabase"
|
|
#mongo = PyMongo(app)
|
|
|
|
#mongo.db.test.insert_one({'_id': 0, 'foo': {'test': 'this'}})
|
|
#mongo.db.test.insert_one({'_id': 1, 'suu': 'sar'})
|
|
|
|
|
|
#@app.route("/")
|
|
#def home_page():
|
|
# test_results = mongo.db.test.find()
|
|
# results = []
|
|
# try:
|
|
# while True:
|
|
# result = test_results.next()
|
|
# results.append(result)
|
|
# except StopIteration:
|
|
# pass
|
|
|
|
#return str(results)
|
|
|
|
@app.route("/")
|
|
def index():
|
|
return str("Test!")
|
|
|
|
#if __name__ == '__main__':
|
|
# app.run()
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0')
|