Re: Discovering the ip/port in use by runserver

2009-10-27 Thread tow
On Oct 27, 1:53 pm, Christian Joergensen wrote: > > You could probably just read it from sys.argv ;) ;-) That had crossed my mind. I think it might actually be the most robust way! You have to do a bit of fiddling to make sure you don't grab an option, and that you don't do this if you're not u

Re: Discovering the ip/port in use by runserver

2009-10-27 Thread tow
Thanks. I'd seen that, and that does indeed work if you're in a view & you've got access to a request object. I was hoping that there was another way, useful when you didn't have a request object to hand. I'm beginning to think the answer is "no" though. Toby On Oct 27, 1:14 pm, Karen Tracey w

Re: Discovering the ip/port in use by runserver

2009-10-27 Thread Christian Joergensen
tow wrote: > I know it uses whatever I specified. What I'm asking is, inside the > django process, is it possible to find out what I specified? > > ie, if I did "./manage.py runserver" - how do I find out, from a view > inside the django process, that I'm running on localhost:8000? > > if I did

Re: Discovering the ip/port in use by runserver

2009-10-27 Thread Karen Tracey
On Tue, Oct 27, 2009 at 8:13 AM, tow wrote: > > Clearly I know what I did, I'm wondering if I can get a view inside > the django process to know what I did. > > > http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.META lists SERVER_PORT among the typical headers.

Re: Discovering the ip/port in use by runserver

2009-10-27 Thread tow
I know it uses whatever I specified. What I'm asking is, inside the django process, is it possible to find out what I specified? ie, if I did "./manage.py runserver" - how do I find out, from a view inside the django process, that I'm running on localhost:8000? if I did './manage.py runserver ot

Re: Discovering the ip/port in use by runserver

2009-10-27 Thread Larrik Jaerico
Perhaps he is looking for a way to get the values passed to runserver, then? On Oct 27, 3:17 am, Jani Tiainen wrote: > tow kirjoitti: > > > If you're running your django server through ./manage.py runserver, is > > there a way, from within the django process, to discover which  IP > > address an

Re: Discovering the ip/port in use by runserver

2009-10-27 Thread Jani Tiainen
tow kirjoitti: > If you're running your django server through ./manage.py runserver, is > there a way, from within the django process, to discover which IP > address and port are in use? It doesn't use anything it just listens whatever you specified at startup. Default is any local address (loc

Re: Discovering the ip/port in use by runserver

2009-10-26 Thread tow
Other than something like this, obviously, which works, but is a bit fragile & certainly not very nice: def get_server_address_by_stack_inspection(): import inspect for s in inspect.stack(): if (s[0].f_code.co_filename.endswith("django/core/ servers

Discovering the ip/port in use by runserver

2009-10-26 Thread tow
If you're running your django server through ./manage.py runserver, is there a way, from within the django process, to discover which IP address and port are in use? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "D