I’ve developed a Flask app that runs perfectly on my laptop – all endpoints work perfectly and I’ve also created several HTML pages that interact with the Flask API endpoints.
The next step is to deploy this (permanently) to AWS EC2 (Ubuntu). I’ve followed this tutorial about creating a Flask app https://plainenglish.io/community/deploying-a-flask-application-on-ec2-dab5d3 and the “hello world” works perfectly.
I replaced app.py with my own code and again the / endpoint works fine – but no other endpoint does, I keep getting 404 errors.
I’ve been trying to narrow the reason, but even if I create a /test endpoint it doesn’t work (via a browser and the public IP) and returns a 404. If I SSH to the EC2 and run
curl HTTP://127.0.0.1:8000/test
it works – I can see the HTML being returned.
What am I missing?
1