Skip to content

Instantly share code, notes, and snippets.

@kvalle
Created October 10, 2013 15:20
Show Gist options
  • Save kvalle/6920172 to your computer and use it in GitHub Desktop.
Save kvalle/6920172 to your computer and use it in GitHub Desktop.
Enkel server for Extreme Startup med Flask i Python
import re
from flask import Flask, request
app = Flask(__name__)
@app.route('/', endpoint='index')
def index():
question = request.args.get("q", "").partition(": ")[2]
answer = "the answer"
print "\nQ: %s?\nA: %s" % (question, answer)
return answer
if __name__ == "__main__":
app.run(debug=True, port=1337, host="10.0.50.102") # bytt ut med din IP her
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment