DEV Community

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

Collapse
 
huogerac profile image
Roger Camargo

Hi everyone!
It did work, however, I'd suggest few changes to make this post simpler:

  • Create the virtualenv first, preferably outside the project (instead of venv inside vercel-python-app, use ~/.venv/vercel for example)
  • active our virtualenv and install Flask
  • create the vercel-python-app folder, the index.py and the data.json
  • make sure it is working locally
  • create the requirements.txt and vercel.json inside the project folder (vercel-python-app)
  • lastly, inside the vercel-python-app (instead of venv folder), run the vercel command. In this way the deploy will work at first! It won't send all the site-packages, you won't need to duplicate the files

In another word, in this way, you can use the default python/flask structure. Just adding the vercel.json and running the vercel cmd, you make the deploy. Awesome!