Reputation: 1
I have a React-Flask application that works well locally, but I've run into issues upon attempting to deploy it to Render. The home page loads, but when one attempts to log in, the server returns a 500 every time.
When I ran the app using gunicorn on my local system, I thought things were going smoothly. But I've come to realize the discrepancy, I think: My config.py
file loads the secret_key
from my .env
file, using load_dotenv()
. It works fine when I run gunicorn while within pipenv shell. But if I run guinicorn just in the default .venv, attempting to log in bounces back an error saying that "no secret key was set." Using good old-fashioned print statements, I can confirm this: the secret_key
is read just fine by my config when running from within pipenv shell, but when running in .venv, it's just blank.
So, my working theory is that Render's Start Command (which executes gunicorn) would not be able to get into the pipenv shell, and that's why the deployed version is not working. But I have no idea how to fix that. Maybe something can be patched up with the requirements.txt
? I'm not sure. I think this is exposing my lack of fluency with understanding different virtual environments, so I've got my work cut out for me there. In the meantime, though, does anyone have a light they may be able to shine here on what may be happening or how to fix it?
I attempted to add the command to enter pipenv shell to the start command on Render, but that doesn't work. I also tried various other commands from dotenv (find, etc) to see if that helped .venv to find the variable appropriately, but no luck. I've also tried accessing the variable through bracket notation instead of .get, but that didn't work either.
Upvotes: 0
Views: 79