Issue
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
I am following this flask tutorial.
^ When Running the program using python run.py
the code below runs fine. But when I follow the instructions from the tutorial -> ./run.py
I end up getting this ->
from: can't read /var/mail/flask
./run.py: line 2: syntax error near unexpected token ('
./run.py: line 2: app = Flask(__name__)
Code I'm running
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
Does anyone know why it's not running properly when using the ./run.py
? using Mac
Solution
do the following (assuming you are on mac/linux) chmod 755 file.py
the file is your file.
#!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
if __name__ == '__main__':
app.run()
Answered By - Seekheart
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.