Forums

Uploading Flask Application (virtualenv)

Python 3.3 Newbie here making his first foray into Flask.

From the tutorials I've come across, you're asked to create a virtualenv sub-folder in your application folder.

How do I upload my application (that I've developed locally on my computer) and its virtual environment onto pythonanywhere? Is it a matter of uploading the virtualenv sub-folder onto pythonanywhere? What changes do I need to make to the wsgi folder that pythonanywhere has provided?

Virtual environments are not transferable between machines. They are dependent on all sorts of things like the architecture and the directory layout. If you want to reproduce a virtual environment from your computer on PythonAnywhere, you should use pip freeze to create a requirements file and then use the requirements file to re-create the environment on PythonAnywhere.

Using your virtualenv in a web app is pretty simple and is descrbed on this wiki page (Look for the code block that starts with activate_this)