Last active
January 25, 2016 00:15
-
-
Save Karunamon/bbdd7c5b7625198a634b to your computer and use it in GitHub Desktop.
Flask Class Shenanignas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
import thread | |
web = Flask(__name__) | |
class AwesomeClass(object): | |
def __init__(self): | |
thread.start_new_thread(web.run, ()) | |
self.some_important_var = "spam" | |
@web.route('/order/<args>') | |
def some_web_function(self, args) | |
return "Your order: " % self.some_important_var + args | |
# wget http://localhost:5000/order/eggs | |
# Oh noes! | |
# TypeError: some_web_function() tkaes exactly 1 argument (0 given) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment