I'm attempting to move a project from virtualenv
to buildout
, but I don't think I've grasped the whole concept of buildout
. All the tutorials I've found discuss buildout
in the context of using it with Zope
, which I'm not using and therefore can't see how to continue.
My file structure with virtualenv
is as follows:
myapp/
app.py
Which is run using /path/to/venvs/myapp/bin/python /path/to/myapp/script.py
.
With buildout
, my file structure is:
myapp/
app.py
bootstrap.py
buildout.cfg
Running python bootstrap.py
and bin/buildout
gives me these additional files:
myapp/
bin/
buildout
eggs/
setuptools-0.6c12dev_r80622-py2.6.egg
tornado-1.0.1-py2.6.egg
parts/
At this point I'm unsure how to "run" my app.
Advice?
The following recipe will, install tornado as an egg and create a python and myapp script in the bin directory with the correct search path to find the tornado egg.
[buildout]
parts = python
eggs = tornado
extra-paths = ${buildout:directory}
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = ${buildout:eggs}
entry-points = myapp=app:main
extra-paths = ${buildout:extra-paths}
Buildout and virtualenv are actually tangentially related. Buildout is really about the deployment of software in a constrained and controlled fashion, where virtualenv is about encapsulating the environment that python software runs within. Buildout provides what virtualenv does within itself, and then wraps a bit more around it.
Think of buildout as the recipe set of how to take your code and lay it down onto a remote system ready to be run. Some of that process starts with creating a clean sandbox (which is what virtualenv can provide as well) - and then adding in libraries, pieces, and parts as you need.
I'm not a buildout expert, but I'd expect your python main code to show up under "bin" in your directory structure, and that you'd be somehow invoking it from there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With