On Sun, Mar 4, 2012 at 11:45 PM, John Anderson <[email protected]> wrote:
>
>> > > Hello --
>> >
>> > > When an app is started, it binds to whatever IP address and port
>> > > number is specified in development.ini. How would you handle this on
>> > > a multi-user computer where several developers are working
>> > > simultaneously via remote X sessions? They all can't bind to the same
>> > > IP/port.
>> >
>> > > Each developer could obviously manually change this before launching
>> > > the HTTP daemon. But that's a pain to do each time. Or each
>> > > developer could have their own .ini file. But then important config
>> > > changes aren't shared between them during SVN commits. I've been
>> > > playing around with some iptables rules, but I don't think it's going
>> > > to work as I need it to. Is there a way I can use environment
>> > > variables in development.ini? Or does anyone have any other
>> > > suggestions? Thanks.
>> >
>> > Change your development.ini to have:
>> > port = %(port)s
>> >
>> > and then have your developers do:
>> > pserve ./development.ini port=8080
>>
>> Thanks, John. I was hoping for an elegant solution like that.
>>
>>
> As an alternative, if your team is using bash, they could define an alias
> in their bashrc:
>
> alias run="pserve ./development.ini http_port=$(lsof -i -P | awk
> '/pserve/ {split($9, a, /:/); print a[2] + 1; f = 1} END {if (!f) print
> "6543"}')"
>
> and in your development.ini
> port = %(http_port)s
>
> and then they would just be able to type 'run' in the directory and it
> would do the rest.
>
That one had a small bug, here is your final alias ;)
alias run="pserve ./development.ini http_port=$(lsof -i -P | grep pserve |
awk '{split($9, a, /:/); print a[2]; f = 1} END {if (!f) print
"6543"}'|sort|tail -1|awk '{print $0+1 }')"
--
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.