Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Perform some action before pserve
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Huang  
View profile  
 More options Oct 24 2012, 11:01 am
From: Mark Huang <zhengha...@gmail.com>
Date: Wed, 24 Oct 2012 08:01:55 -0700 (PDT)
Local: Wed, Oct 24 2012 11:01 am
Subject: Perform some action before pserve

Hi,

I want to set some environment variables on my Ubuntu machine before I run
pserve command.  Reason that it's not set in the ini file is because a
particular python file in my Pyramid web application has no access to
request parameter to retrieve the settings.

I was thinking of overriding pserve command to add the environment
variables in before it starts the application.

Any way to do this?  Couldn't find much about this topic in the docs.  The
closest thing to this was to use a setup script for pshell.....but then
again....it's for the pshell command and not the pserve.

Regards,
Mark Huang


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
薛 斌雷  
View profile  
 More options Oct 24 2012, 12:43 pm
From: 薛 斌雷 <kongpo0...@gmail.com>
Date: Thu, 25 Oct 2012 00:37:03 +0800
Local: Wed, Oct 24 2012 12:37 pm
Subject: Re: Perform some action before pserve

http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/narr/env...

something like this.
$ PYRAMID_DEBUG_AUTHORIZATION=1 PYRAMID_RELOAD_TEMPLATES=1 \
       bin/paster serve MyProject.ini
does it meet your requirements?

On Oct 24, 2012, at 11:01 PM, Mark Huang <zhengha...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Vanasco  
View profile  
 More options Oct 24 2012, 2:44 pm
From: Jonathan Vanasco <jonat...@findmeon.com>
Date: Wed, 24 Oct 2012 11:44:53 -0700 (PDT)
Local: Wed, Oct 24 2012 2:44 pm
Subject: Re: Perform some action before pserve
For staging/production, I tend to write startup scripts per machine.
For a while i was doing shell scripts, but then I started using
Fabric.

For local development, i have a 'source' file , that typically does
this:

  1. cd path_to_pyramidapp
  2. source path_to_virtualenv/bin/activate
  3. handle any variables

whenever i need to start working on a project:

  $ source go_myapp.source

and then i'm in the right directory, with the right virtualenv, and
all the right env vars


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Benjamin Sims  
View profile  
 More options Oct 24 2012, 4:00 pm
From: Benjamin Sims <benjamins...@gmail.com>
Date: Wed, 24 Oct 2012 21:00:13 +0100
Local: Wed, Oct 24 2012 4:00 pm
Subject: Re: Perform some action before pserve
For this purpose, I use virtualenvwrapper. You can then put everything into your postactivate file (in /bin) and it will be run automatically.

-- Sent from my phone

On 24 Oct 2012, at 19:44, Jonathan Vanasco <jonat...@findmeon.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Huang  
View profile  
 More options Oct 25 2012, 2:51 am
From: Mark Huang <zhengha...@gmail.com>
Date: Wed, 24 Oct 2012 23:51:13 -0700 (PDT)
Local: Thurs, Oct 25 2012 2:51 am
Subject: Re: Perform some action before pserve

Thanks for your answer Jonathan.  I agree with you.  For
staging/production, fabric is the way to go, even though I haven't taken
time to learn it properly yet.  

For development, ....our team is really young and new to Python, linux for
that matter.  I'm in China, everyone uses Windows here.  I wanted a one
step solution such that it doesn't change their workflow as to how they
start up their development Pyramid application (they still continue to use
pserve --reload development.ini).  

I think I'll combine your answer with `somewhattofftheway` and add it to
the postactivate file of virtualenvwrapper.

Thanks everyone!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »