Deploy my Django rest framework app to Vercel

34 Views Asked by At

I'm trying to deploy my Django Rest framework app using vercel. While building, I got an error "Error: Unable to find any supported Python versions."

My vercel.json is below.

{
"version": 2,
"regions": ["hnd1"],
"builds": [
{
    "src": "myproject/wsgi.py",
    "use": "@vercel/python",
    "config": {
    "maxLambdaSize": "15mb"
    }
},
{
    "src": "build_files.sh",
    "use": "@vercel/static-build",
    "config": { "distDir": "static" }
}
],
"routes": [
{
    "src": "/static/(.*)",
    "dest": "/static/$1"
},
{
    "src": "/(.*)",
    "dest": "myproject/wsgi.py"
}
]
}

I confirmed that I could successfully download django and other things. (it means build_files.sh is executed correctly.) I think I might have problems with static files. I added static root and url to settins.py

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

and added urlpatterns to urls.py

urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

Why is this error occurred? I appreciate your opinion and advice!

0

There are 0 best solutions below