Deploying python 2.7 flask app
Hello, I have no choice but to use python 2.7. However i am having trouble deploying my flask application.
venv doesnt exist until python 3 , how can i deploy it with virtualenv instead?
15 Replies
Project ID:
N/A
⚠️ experimental feature
wouldn't recommend using a virtual environment in a production setting, the containers are all destroyed and remade on each redeploy anyways so you can just have a requirements.txt file in the root directory and it will be automatically picked up and installed if you're using nixpacks
is there way to disable? my requirements.txt file just has
started failing once i added a runtime.txt with python-2.7.10
try removing the last line there, but you'll need to set the nixpacks python version like documented here https://nixpacks.com/docs/providers/python
Python | Nixpacks
App source + Nix packages + Docker = Image
and rename any
Dockerfile
you may have to something like Dockerfile.dev
thanks, ill give it a try and report back
For people in future: Was able to get it the venv addressed by using following nixpacks.toml
However I am now getting new error,
Traceback (most recent call last):
File "main.py", line 1, in <module>
from flask import Flask, request, abort
ImportError: No module named flask
with my requirements.txt
why is flask in there twice? should just be the capital f
Flask
iircmy apologies it is just the capital F, meant to delete that
ah so the start command doesn't activate the virtualenv first
change it to be like this
I changed the [start] cmd to a single string as thats what it was expecting
looks like the virtualenv its creating is using 3.10.9 and not 2.7
try removing virtualenv entirely and just using something like this
i think that would be where nix installs the python2 package
odd because that one link you shared has 2.7 on there
could have updated your app to use python3 by now
trust me if i could i would