how to use WSGI applications with apache

  • Thread starter travis+ml-python
  • Start date
T

travis+ml-python

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 (e-mail address removed) 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-----
 
P

Paul Rudin

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top