[Flask] slightly OT: packaging/moving flask app with virtualenv

Corey Boyle coreybrett at gmail.com
Wed May 4 10:07:28 EDT 2016


Virtualenv works by temporarily changing the active PATH so that your
scripts see an alternate (and isolated) Python interpreter and
libraries instead of seeing the globally installed ones.

So... I don't think it would ever be to late to start using a virtualenv.
Perhaps the only thing that could be effected is the paths of your
import statements.

Basically, you need to setup a virtualenv on the server, that matches
the virtualenv on your dev box, and tell Apache to use it when
executing your Python scripts. (I've never used Apache with Python, so
I can't help with that part.)

I also like using virtualenvwrapper, but I'm not sure if that would
help or hurt you at this point.

On debian...
apt install python-virtualenv
apt install virtualenvwrapper

What OS are you using for development?

On Wed, May 4, 2016 at 9:06 AM, Alex Hall <ahall at autodist.com> wrote:
> Hey list,
> At the urging of several members here, I'll give virtualenv a shot while I'm
> installing and moving everything. Currently, I have my Flask app working.
> It's small--just a couple pages with a bunch of JS--but does need Pyodbc and
> WTF to work. Is there a way I can take my existing app, put it into a
> virtual environment, and toss the whole thing on my Debian server? I've
> installed virtualenv on the server already, as well as UWSGI. Is this
> doable, or should I upload the entire directory and somehow put it into a
> virtual environment on the server? Am I too late--that is, can this only be
> done when you start a new project?
>
> --
> Alex Hall
> Automatic Distributors, IT department
> ahall at autodist.com
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>


More information about the Flask mailing list