[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live) [Help](/c/help/9) # Deploying a Flask app with Vercel 293 views · 3 likes · 7 posts Zaydloya (@zaydloya) · 2024-08-04 Hi, I am trying to deploy my Flask webapp on Vercel, but I am having problems with deployment. Everything runs fine locally. I am a rookie and making this kind of project for the first time, so I am not entirely sure what to override in vercel.json and under what configuration category my project falls under. My html page loads, but whenever I click any of the buttons that run the backend functions, there are error 404s on the fetch requests. This is my file structure  This is my vercel.json ``` { "version": 2, "builds": [ { "src": "api/*.py", "use": "@vercel/python" }, { "src": "api/static/index.html", "use": "@vercel/static" } ], "routes": [ { "src": "/", "dest": "/api/static/index.html" }, { "src": "/api/(.*)", "dest": "/api/app.py" }, { "src": "/(.*)", "dest": "/api/app.py" } ] } ``` These are the routes defined in my `app.py`:  I appreciate any help. Thanks a lot! Pauline P. Narvas (@pawlean) · 2024-08-05 · ♥ 1 Hi, @zaydloya! Looking at your `vercel.json`, it looks like the issue may be because: * The `"src": "/api/(.*)"` route is targeting the `/api/app.py` file, which might not be handling all the routes properly. * The `"src": "/(.*)"` route also targets `/api/app.py`, which could be causing conflicts. I'm also sharing an example Flask app for anyone looking at this and wanting to see how deploying a Flask app would look like on Vercel. https://vercel.com/templates/python/flask-hello-world Pauline P. Narvas (@pawlean) · 2024-08-06 · ♥ 1 Sharing a new post about how to debug 404 errors, in case it's helpful! https://community.vercel.com/t/debugging-404-errors/437 Jeff9497 (@jeff9497) · 2024-08-16 Hello I have tried deploying a flask web app but I am still encoutering the 404 not found error  ..... here is my file structure  .... also here is the run.py code  ..... I thought the requirements.txt code would also help anyone solve my error Flask==3.0.3 yt-dlp==2024.7.12 gunicorn==20.1.0 Pauline P. Narvas (@pawlean) · 2024-08-16 Hi, @jeff9497! Similar to my suggestion above, it looks like it might be related to your routes. https://community.vercel.com/t/deploying-a-flask-app-with-vercel/439/2 The `vercel.json` file seems to point to `run.py`, which is fine, but make sure that your Flask application is set up correctly to run on Vercel. The line `"src": "/(.*)", "dest": "/"` in the `routes` section might be overly broad, and it's possible that it isn't correctly pointing to your Flask app's routes. You could try removing or modifying this line to ensure that the routes are handled as expected. It'd be helpful to get a [minimal reproducible example](https://vercel.com/guides/creating-a-minimal-reproducible-example) for us to dig deeper. Jeff9497 (@jeff9497) · 2024-08-16 hey i tried that but still the web page gives me the 404 error  .... here is the vercel deployment page  Jeff9497 (@jeff9497) · 2024-08-20 · ♥ 1 hi @pawlean I was able to deploy it and without the 404 not found but only after deploying it via the CLI(one is not required to use a virtual environment during this ) however with this the CSS was not loading either locally or even after deployment . Incase I solve this I will be in touch .