Reputation: 90
I am new to flask and twilio and I am getting a 404 error running my app (I am following this tutorial: https://www.twilio.com/blog/2012/01/making-an-sms-birthday-card-with-python-and-flask.html) . I have googled this and search stack overflow but I can not fix it. Below is my code:
from flask import Flask
import os
app = Flask(__name__)
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
if port == 5000:
app.debug = True
app.run(host='0.0.0.0', port=port)
And I get this error: 404 Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
I am running my app from the terminal by going: python app.py
Upvotes: 0
Views: 1674
Reputation: 379
You don't have any route mapping
from flask import Flask
import os
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
if port == 5000:
app.debug = True
app.run(host='0.0.0.0', port=port)
Upvotes: 2