How to deploy a Pyramid app using pserve without installation?
Asked Answered
G

2

5

I'm a beginner for Pyramid.

I want to deploy Pyramid to my production server. I have a deploy script using Capistrano to do this.

set :pid_path, "/var/lib/#{application}"
set :log_path, "/var/log/#{application}"

namespace :deploy do

    task :restart, :roles => :app do
    end

    task :finalize_update, :roles => :app do
        run "cd #{release_path} && python setup.py build"
        %w[ 5000 5001 ].each do |port|
            run "if [ -f #{pid_path}/#{port}.pid ]; then paster serve --stop-daemon --pid-file=#{pid_path}/#{port}.pid; fi"
            run "paster serve --daemon --pid-file=#{pid_path}/#{port}.pid --log-file=#{log_path}/paster.log #{release_path}/production.ini http_port=#{port}"
        end
    end

end

But it does not work without installation typing 'sudo python setup.py install'. If I write code to do this, it might work but I don't want to do it because of permissions.

Does someone have any suggestions?

Gadson answered 28/2, 2012 at 8:27 Comment(0)
I
5

Okay, your best bet is to set up a virtualenv , activate it and then install the application in that virtualenv and run it from there :-)

Besides that there are options of using the setuptools/distutils to install into your local user folder by using the --user argument to easy_install as noted here: http://docs.python.org/install/index.html

But seriously, use virtualenv :-)

Interrupt answered 28/2, 2012 at 10:54 Comment(1)
Thanks! I didn't know this option. I consider to use virtualenv. (I have knew about this, but I don't want to use it.) I should rewrite the deploy script.Gadson
P
4

Either install the application into a virtualenv or use python setup.py develop which will link your project into the python environment (virtualenv or system depending on what python you invoked). This is usually preferable to python setup.py install because it keeps your source in a manageable location and doesn't require you to worry about manifest files to ensure that your static resources are in the installed bundle.

Pascia answered 29/2, 2012 at 2:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.