Skip to content

Instantly share code, notes, and snippets.

@mihajenko
Created April 23, 2017 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mihajenko/81f8be41df15f2a818918f9bb3bb9346 to your computer and use it in GitHub Desktop.
Save mihajenko/81f8be41df15f2a818918f9bb3bb9346 to your computer and use it in GitHub Desktop.
"""
flask related code
"""
from flask import *
from celery_defs import my_background_task
def main():
app = Flask(__name__)
app.config['CELERY_BROKER_URL'] = 'redis://localhost:6379/0'
app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost:6379/0'
@app.route('/createServer', methods=['POST'])
def createServer():
task = my_background_task.apply_async(args=["test0", "test1"], countdown=10)
return jsonify({"status": "done"})
app.run(host='127.0.0.1', port=8080, debug=True)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment