On Fri, May 20, 2011 at 2:00 AM, Jojo <[email protected]> wrote: > Hi, I have a big headache for pylons app egg installation. > As I have read around the net, there are a lot of ways to deploy a > Pylons app. I have choose to use a virtualenv + easy_install, because > it seems the most easy. > I have read a lot of time the official documentation, but there is > something that I can't understand. > I'm going to summarize the steps I followed: > - virtualenv creation through go-pylons.py script > - project creation of course, bla bla bla... > - creation of the egg -> python setup.py bdist_egg - egg appear in the > dist directory > > 1) Now, one of the many documents I have read for packaging > application is this: > http://docs.pylonsproject.org/projects/pylons_framework/dev/deployment.html > and in the "Egg Files" section it says: > > "All Pylons applications are distributed in .egg format. An egg is > simply a Python executable package that has been put together into a > single file."
This is mainly for publicly-distributed applications, such as demos or generic blog software, where somebody you don't know will be installing the application. There are other approaches which are more common if you or somebody in your organization is the sysadmin. The simplest is to put the application source into version control and check it out on the server. Then you can create the virtualenv and run "pip install -e .", "python setup.py develop", "python setup.py install", or "easy_install .". (These all install the application and its dependencies, but each does it in slightly different ways. The first two make a link back to the source directory; the last two copy the files. 'pip' uses the traditional directory structure; 'easy_install' makes an *.egg directory or zipped file.) You can also make a tarball of the source directory, either manually or via 'python setup.py sdist'. The egg file format (meaning specifically *.egg directories or zipped files, not the general concept of egg-info metadata) did not live up to its high expectations, and there's disagreement on how useful it is. The alternative is a source tarball. > So, I thought I must copy ONLY the egg file on the production > machine...am I right? If the package has no dependencies, you can simply copy the *.egg file or directory to the destination site-packages. But Pylons applications depend on Pylons and other things. The egg contains only the application package and egg-info metadata. So you'll have to install the egg: "easy_install myegg.egg". That will install the egg and its dependencies. > 2) I have not registered my application on PyPi, so I have skipped the > python setup.py register command. Is it not mandatory, right? Correct. This is just if you want to make the application publicly available. But even here, most people upload the source tarball, not the egg. The egg includes only enough to run the application; it doesn't include setup.py, and it may or may not include the docs and tests depending on how the application was structured. (Whether the docs and tests were put inside or outside the package directory, and what the setup.py and MANIFEST.in say.) > 3) So, I'm on the production machine, I have activated the virtual > environment through source and I'm in the egg file directory > (Downloads). > I have executed this command: > > easy_install -f C:\path\with\the\egg\files\in myapplication==0.1 > > with the correct name and version number and I get this message: The -f flag may be expecting a URL, not a directory, and it may expect it to be structured like a PyPI mirror. In any case you can just give the full path to the egg: "easy_install myapp.egg". Or if that doesn't work, "easy_install ./myapp.egg". -- Mike Orr <[email protected]> -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
