Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

python + nginx

flyfly Member
edited July 2012 in Help

does anyone know of a way for python to grab a user's IP address from X-Real-IP that's passed from nginx?

Comments

  • bretonbreton Member

    How do you call python scripts with nginx? CGI, WSGI?

    Thanked by 1djvdorp
  • flyfly Member
    edited July 2012

    it's proxy_pass to gunicorn.

    here's what the nginx block looks like:

    http://sprunge.us/LMcX

    just a note: i'm not going to run django just for this one tiny function.

  • @kbar said: it's proxy_pass to gunicorn.

    here's what the nginx block looks like:

    http://sprunge.us/LMcX

    just a note: i'm not going to run django just for this one tiny function.

    There's no need to use Django. Just use something (anything) with WSGI support and you'll be fine - and that will remove the need for hacky reverse proxy solutions.

  • flyfly Member

    yeah i'm thinking about just using uWSGI with nginx.... the recent move from /lib to /usr/lib is fuxing with uWSGI tho

  • bretonbreton Member

    Just have a look at the contents of environ (first variable of your app function).

  • flyfly Member

    http://mtr.sjchen.net

    \o/

    wait a little for the process to complete... i'm gonna make a starting page so it doesn't just look like it's chillin there / timing out

  • yomeroyomero Member

    @kbar said: wait a little for the process to complete... i'm gonna make a starting page so it doesn't just look like it's chillin there / timing out

    I prefer it with the -n switch
    Maybe you can pass it by get :P

  • flyfly Member

    when i'm not lazy i'm gonna feature creep the shit out of this... don't worry.

Sign In or Register to comment.