Site Deploys Successfully but Shows 404 - Python/Flask Function Not Being Detected

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:

  1. Correct Project Structure: My project has the required netlify/functions/api.py structure, confirmed via screenshots of my local editor and the live GitHub repository.
  2. Valid netlify.toml: My netlify.toml file is in the root directory and has the correct build command, functions directory, and a [[redirects]] rule with from = "/*".
  3. Correct main.py: My Flask app (main.py) has been updated to use absolute paths with pathlib for all file I/O to prevent any FileNotFoundError during startup.
  4. Correct api.py Wrapper: The api.py handler file correctly imports the Flask app and uses serverless_wsgi.
  5. Valid requirements.txt: The requirements.txt file is correct and the pip install command completes successfully in the deploy log every time.
  6. 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 the main branch of my GitHub repository. There is no .gitignore rule blocking these files.
  7. Verified UI Settings: I have manually set the Functions directory to netlify/functions in the “Build & deploy” settings on the Netlify dashboard to ensure it wasn’t being ignored.
  8. Cleared Cache: I have triggered a “Clear cache and deploy site” to ensure no old settings were being used.
  9. 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.

You cannot run Python functions at Netlify. For this reason, it won’t be possible to host this site at Netlify.