how to use WSGI applications with apache

Discussion in 'Python' started by travis+ml-python@subspacefield.org, Oct 6, 2009.

  1. Guest

    Hi folks,

    I'm not quite sure where to ask this, but this is my closest guess.

    I've written a web service based on the newf micro-framework and it uses
    wsgiref.simple_server. I'm noticing that it's not returning response
    codes properly (after fixing a bug in newf). Instead, it just
    closes the TCP connection silently.

    I am assuming that I need to run it with a more sophisticated server,
    and I eventually want to run it under apache, but I can't seem to
    figure out how to do this. Someone once showed me how, and it was
    a simple line in the apache config. But I can't figure it out how
    to do again.

    Any help?
    --
    Obama Nation | My emails do not have attachments; it's a digital signature
    that your mail program doesn't understand. | http://www.subspacefield.org/~travis/
    If you are a spammer, please email to get blacklisted.

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (OpenBSD)

    iQIcBAEBAgAGBQJKy7fVAAoJEGQVZZEDJt9HArMQAItA/DpaIpw7VLs1lcdbJs4t
    miU+jo7EFYKDF226Uy/iHMHe7tnuAX7qdkzymRJbwrPF6f3eyfiiE04iUM867Z1Z
    NKClBE9qDlcZLTzdEfJI38N6BE7qYUjxLe+nCizMRtKOdm/uTl4dCcYd6Ee0/ast
    Bl9tSiDq7jeqhaRgBs94AYVZRVUdqsqz7xKBx6lekxLaVL/w8GURznUpciurkLKp
    32sVC9SG0YJajpmriXnHYRPDrqwZiBO0I0qKyWi6cRPpqbbk+fLx7tsW24RJoIqM
    60Oq+q9BviuNBTLtSXAqtjAxLZykbmOoy4vsTGATzgr2bNrFSOKqd79vp9vY3s+F
    ps4IQec66YyuoAwfQt8Kr0GggCkNMZOxZqHhQ8SjIWuL6qeL326RVDwEAjzoIJJo
    c6vFaBI4wHYD7wfFYe/c/ZjwLWo3ddFOHCYvs8KMSWwUzGsQqrjqrNlhsoO+uN9C
    mFt9Lp4c8RqR+wDhDc1ceUdYTcKmBBn1SQgeYMXPfkA5QTMDaPa2EtFmWS5abtRl
    7mipi9+dJrthCiLEhNACwTMrrIRbxtej2hnJ+mGKTUtna3uf4n+D4jpuVQqMjwgO
    eS6ZUhfV19CzvaA2fP7YaAf3W4Ax9xk3x2DyLUZbDKso/yoc0DweykT3En50AL+K
    eyNs4tlH1mY0utcNCjxh
    =DshM
    -----END PGP SIGNATURE-----
     
    , Oct 6, 2009
    #1
    1. Advertising

  2. Paul Rudin Guest

    writes:

    > Hi folks,
    >
    > I'm not quite sure where to ask this, but this is my closest guess.
    >
    > I've written a web service based on the newf micro-framework and it uses
    > wsgiref.simple_server. I'm noticing that it's not returning response
    > codes properly (after fixing a bug in newf). Instead, it just
    > closes the TCP connection silently.
    >
    > I am assuming that I need to run it with a more sophisticated server,
    > and I eventually want to run it under apache, but I can't seem to
    > figure out how to do this. Someone once showed me how, and it was
    > a simple line in the apache config. But I can't figure it out how
    > to do again.
    >
    > Any help?


    There are all manner of things that you can configure. First you need to
    enable mod_wsgi - on as linux box this should be something like:
    "a2enmod wsgi"

    Then you need something like this inside a suitable virtualhost tag in
    your apache configuration files:


    WSGIDaemonProcess test threads=1 processes=1 maximum-requests=10000 \
    python-path=/dir/for/my/script

    WSGIProcessGroup test

    WSGIScriptAlias /test /dir/for/my/script/myscript.wsgi

    <Directory /dir/for/my/script>
    Order allow,deny
    Allow from all
    </Directory>


    The file myscript.wsgi is a python module within which "application"
    names your wsgi application.
     
    Paul Rudin, Oct 7, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Davis
    Replies:
    0
    Views:
    738
    John Davis
    Aug 21, 2003
  2. Wolfgang
    Replies:
    5
    Views:
    1,480
    Tris Orendorff
    Feb 19, 2004
  3. Alan Kennedy
    Replies:
    0
    Views:
    274
    Alan Kennedy
    Apr 13, 2009
  4. Alice Bevan–McGregor

    Streaming templating languages for use as WSGI body.

    Alice Bevan–McGregor, Jan 5, 2011, in forum: Python
    Replies:
    0
    Views:
    211
    Alice Bevan–McGregor
    Jan 5, 2011
  5. Barry Dick

    python\bluetooth / wsgi / apache 2.2

    Barry Dick, Dec 13, 2012, in forum: Python
    Replies:
    0
    Views:
    141
    Barry Dick
    Dec 13, 2012
Loading...

Share This Page