Title: Site Deploys Successfully but Shows 404 - Python/Flask Function Not Being Detected
Body:
Hello Netlify Support Team,
I need help with a very persistent issue on my site. The site deploys successfully every time (the build log shows “Published” in green), but the live URL returns a 404 “Page not found” error on all paths.
- Netlify Site Name:
skydx.netlify.app - GitHub Repository:
https://github.com/Praveenkumar76/Clinical-Guidance-System
The Core Problem:
The main issue seems to be that my Python serverless function, located at netlify/functions/api.py, is not being detected during the build process. Because of this, the “Functions” tab in my site dashboard is completely empty, showing the “Build your first function” message. Since the function isn’t deployed, the redirect rule has nowhere to send the request, resulting in a 404 error.
Troubleshooting Steps I Have Already Taken:
I have worked extensively to debug this and can confirm the following:
- Correct Project Structure: My project has the required
netlify/functions/api.pystructure, confirmed via screenshots of my local editor and the live GitHub repository. - Valid
netlify.toml: Mynetlify.tomlfile is in the root directory and has the correct build command, functions directory, and a[[redirects]]rule withfrom = "/*". - Correct
main.py: My Flask app (main.py) has been updated to use absolute paths withpathlibfor all file I/O to prevent anyFileNotFoundErrorduring startup. - Correct
api.pyWrapper: Theapi.pyhandler file correctly imports the Flaskappand usesserverless_wsgi. - Valid
requirements.txt: Therequirements.txtfile is correct and thepip installcommand completes successfully in the deploy log every time. - Verified Git Repository: I have confirmed that all the correct files and folders (
netlify.toml,netlify/functions/api.py, etc.) are present and up-to-date on themainbranch of my GitHub repository. There is no.gitignorerule blocking these files. - Verified UI Settings: I have manually set the Functions directory to
netlify/functionsin the “Build & deploy” settings on the Netlify dashboard to ensure it wasn’t being ignored. - Cleared Cache: I have triggered a “Clear cache and deploy site” to ensure no old settings were being used.
- Deleted and Re-created Site: As a final step, I completely deleted the site from my Netlify account and re-created it from the same GitHub repository. The problem still persists even on a completely fresh site instance.