Next.js Discord

Discord Forum

Running a Python virtual environment in NEXT.JS?

Unanswered
House Wren posted this in #help-forum
Open in Discord
House WrenOP
Hi I was able to run a python script through a virtual envirnoment in my nextjs app and get a "hello world" back from this script to the browser it works fine in developement but it doesn't work in production and the error suggest that it can't reach the path I gave it here the code and the err

18 Replies

Giant panda
On Vercel you have no access to the file system and the environment doesn't expose any Python interpreter for use in scripts unless you deploy a dedicated Python application
House WrenOP
so I can't host this app on vercel I need to make a seprate py app and fetch data from that app, is there a way to host my app as it is for free?
Giant panda
You can host both on Vercel
Both the Python app as a backend and a server function in JS for example on Vercel as well
Even though that latter might be redundant
House WrenOP
can I have 2 apis one in nodejs and one in python in a nextjs app and host it on vercel?
but I think it was meant to host a backend in python it didn't mention using it in a nextjs app
or maybe I didn't understand it correctly
Giant panda
You can't mix Next with Python
They have to be separate deployments in separate environments
House WrenOP
got it
That's harder than I thought it would be but at least I have an idea where to go
just another question if I created a sperate python server on vercel would be able to send requests at anytime to fetch data from it? and is it free ?
Giant panda
Yes and it's free as long as it's within the limits of the hobby tier
House WrenOP
Many thanks
Manx
I assume it goes without saying that you can't mix Next with Python and Turbo repo then @Giant panda ?
@Manx I assume it goes without saying that you can't mix Next with Python and Turbo repo then <@141252432054190080> ?
European sprat
Tueborepo is a build system. It doesn't matter if you're using the legacy build system or tueborepo