I have started with python n flask few days ago. I was just trying to run a python file webapp.py
on a terminal
with following code but got errors:
$ ./webapp.py
from: can't read /var/mail/flask
from: can't read /var/mail/flask
./webapp.py: line 3: syntax error near unexpected token `('
./webapp.py: line 3: `app = Flask(__name__)'
But it runs successfully with the command:
$ python webapp.py
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
webapp.py
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
def home():
return render_template('home.html')
if __name__ == '__main__':
app.debug = True
app.run(host='0.0.0.0', port=5000)
As a part of curiosity,
- Whats the difference between
./webapp.py
andpython webapp.py
?