I've usually deployed my Flask applications with a fairly simple fabric script that put the source on the target machine, used pip to install any dependencies, then fired up uwsgi with all the necessary settings and off it went.
However, I have a new issue that some new security settings in our environments have blocked us from access outside the network so trying to use pip to install our dependencies fails. I looked into using python setup.py sdist
to create a package thinking this would build everything down on the developer machine then I could upload the .tar.gz to the deployment machine and install it but it is still trying to contact pip to get the dependencies.
Is there a way to get a completely compiled package with dependencies and all that I could use to deploy to my server? Is there some sdist
setting I can use?
Assuming your build machine is binary-compatible with the target, or you don't need any compiled extensions, you can use
pip wheel
to compile you project and all its dependencies to wheels, copy those files to the server, andpip install
from the wheel directory only.You should be able to copy the odd sdist into the --find-links directory as well, in which case pip will install from the sdist, if you have to recompile on the server.