> I do prefer to use auto-assigned ports as it eliminates the need to manage
> port numbers and ensures zero conflicts.
>
> But there are times when it is nice to know the port number, ( my case
> here
> being the ability to deploy the Django debug toolbar in production but
> limit it to the localhost.)
>
> I know that I can grep the port out of the log:
>
> grep auto-assigned *|tail -1
> my_wsgi_app.log:uwsgi socket 1 bound to TCP address 127.0.0.1*:35127*
> (port
> auto-assigned) fd 5
>
> yielding, of course, port 35127 in this case.  And this is what I do right
> now.  I can certainly build me a little script to grab that and run with
> it...
>
> However, I'd like to know if this can be extracted from the running
> application itself.
>
> Here, I'm launching a Django app pretty much standardly and as such:
>
> import os
> os.environ.setdefault("DJANGO_SETTINGS_MODULE","myapp.settings")
> from django.core.wsgi import get_wsgi_application
> application=get_wsgi_application()
>
>
> So, is the port number available within the application?; and if so, how
> do
> you access it?
>
>
> Thanks in advance/best regards
>
> Steve Walker
> Middle Fork Geographic Information Services
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>

Hi, the stats server exposes it in the "sockets" array:

"sockets":[
                {
                        "name":":48026",
                        "proto":"uwsgi",
                        "queue":0,
                        "shared":0,
                        "can_offload":0
                }
        ],

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to