I am trying to build y first webservice using Python Flask. I am not able to understand what does it mean for Flask to emit out Restarting with reloader, every time i run my app.
This is my code.
#!venv/bin/python
from flask import Flask
from flask import request
def buildCache():
print 'Hello World'
buildCache()
app = Flask(__name__)
@app.route('/search')
def index():
query = request.args.get('query','', type=str);
return query
if __name__ == '__main__':
app.run(debug = True)
when i run it
venv/bin/python ./app.py
Hello World
* Running on http://127.0.0.1:5000/
* Restarting with reloader
Hello World
I dont understand why buildCache method is being called twice? It seems to be related to "Restarting with the reoloader', what does that mean? How do i make sure that buildCache is only executed once, before the server starts.