DEV Community

Discussion on: How to deploy a Python/Flask App to Vercel

Collapse
 
sebasec96 profile image
SebasEC • Edited

Hi, i can't make it work. The deployment is successful but when i try to load the page it says 404: NOT_FOUND. Locally it works fine, i'm using wsl.

Collapse
 
sebasec96 profile image
SebasEC

Solution

{
    "version": 2,
    "builds": [
        {
            "src": "./index.py",
            "use": "@vercel/python"
        }
    ],
    "routes": [
        {
            "src": "/(.*)",
            "dest": "index.py"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
adam_lala profile image
adam_lala • Edited

Update as of 1/1/2022

I used a vercel.json file with:

{
    "version": 2,
    "builds": [
        {
            "src": "index.py",
            "use": "@vercel/python"
        }
    ],
    "routes": [
        {
            "src": "/(.*)",
            "dest": "index.py"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

Changing the src from ./index.py to index.py got rid of an error message:

WARN! You defined 1 build that did not match any source files (please ensure they are NOT defined in .vercelignore): 
Enter fullscreen mode Exit fullscreen mode
Collapse
 
andrewbaisden profile image
Andrew Baisden

Hey does wsl mean Windows Subsystem for Linux? If so that is likely why it is not working. I don't think this method works well on Linux see the comments. It's probably better to use lambda.