Vercel.json not working, 404 not found error

im trying to create an INCREDIBLY simple backend for a web app im trying to build, and i cannot figure out how to correctly host it here on Vercel.

i think i just dont understand vercel.json. i have one single python script inside of my api folder, and in the root folder i have my requirements.txt and my .db file. ive tried many different configurations, similar to seen below. ill either get errors saying something like “Function Runtimes must have a valid version, for example now-php@1.0.0.”

or when i try other configurations, i just cant access the database at all.

{
“version”: 2,
“builds”: [
{
“src”: “api/app.py”,
“use”: “@vercel/python”
}
],
“routes”: [
{
“src”: “/api/(.*)”,
“dest”: “api/app.py”
}
]
}

My python script and database work perfectly on my localhost. please help!

im trying to figure out if it is possible to have a static splite database that i can access with my python script to use vercel as a backend for my website. is this possible? if so, how do i achieve this with vercel.json?

Hey @tabuariki! You can specify the version number, like @vercel/python@4.3.0 from one of those available in the npm package at https://www.npmjs.com/package/@vercel/python?activeTab=versions

However, any *.py files in the /api directory should automatically use the Python Runtime. Meaning you could remove that builds section entirely.

A database is a trickier thing since you wouldn’t be able to write to the files after they were deployed. An external database, or one of the Vercel Storage options, is typically the preferred solution for data storage.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.