You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pylons-discuss
Hi all,
is there an elegant way in the central main(..)-function to determine if the application was started from pserve or pshell? I'm launching a background thread from there, which does some regular polling of a 3rd-party API. Obviously I don't want to start that thread when the application is launched from pshell, but I don't see an easy way to prevent that.
Thanks and best regards, Martin
Oliver
unread,
Jul 29, 2015, 8:33:50 AM7/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pylons-...@googlegroups.com
You could check which modules are imported... the pserve script is loading stuff from paste.deploy so these modules
should be present in sys.modules
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pylons-discuss, mstei...@gmail.com
On Wednesday, July 29, 2015 at 2:06:29 PM UTC+2, Martin Stein wrote:
Hi all,
is there an elegant way in the central main(..)-function to determine if the application was started from pserve or pshell?
Don't know if it's elegant but sys.argv[0].endswith('pshell') is true when you are using pshell
Martin Stein
unread,
Jul 29, 2015, 9:13:39 AM7/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pylons-discuss, ga...@gawel.org
I like the sys.argv[0]-approach: It's simple and readable. Should have thought of it myself. And longer term I should probably switch to an approach with a separate daemonized process (using Pyramid's command-line helpers).