Vitor Anghében
Vitor Anghében

Reputation: 25

How to solve the Runtime.ImportModuleError: Unable to import module 'vc__handler__python': No module named 'django' error on Vercel?

I'm trying to deploy a Django Project on Vercel but I'm facing this error bellow:

Runtime.ImportModuleError: Unable to import module 'vc__handler__python': No module named 'django'

I've preapered my settings.py allowing vercel deployment as bellow:

ALLOWED_HOSTS = ['127.0.0.1', '.vercel.app', '.now.sh']

And edit my JSON file too as bellow:

{
    "builds": [{
        "src": "ang/wsgi.py",
        "use": "@vercel/python",
        "config": { "maxLambdaSize": "15mb", "runtime": "python3.9" }
    },
    {
      "src": "build.sh",
      "use": "@vercel/static-build",
      "config": {
        "distDir": "staticfiles"
      }
    }
    ],
    "routes": [
        {
            "src": "/static/(.*)",
            "dest": "/static/$1"
        },

        {
            "src": "/(.*)",
            "dest": "ang/wsgi.py"
        }
    ],
    "outputDirectory": "staticfiles"
}

My requirments also shows that I've Django installed

asgiref==3.7.2
dj-static==0.0.6
Django==4.2.6
django-stdimage==6.0.1
Pillow==10.0.1
sqlparse==0.4.4
static3==0.7.0
typing_extensions==4.8.0
tzdata==2023.3
whitenoise==6.5.0

So does anyone knows what is causing the problem??

I've try to install whitenoise already, change folder roots and install different django modules

I was expecting to fix this Runtime.ImportModuleErro

Upvotes: 1

Views: 548

Answers (0)

Related Questions