wsgi

Share Python Interpreter in Apache Prefork / WSGI

I am attempting to run a Python application within Apache (prefork) with WSGI in such a way that a single Python interpreter will be used. This is necessary since the application uses thread synchronization to prevent race conditions from occurring. Since Apache prefork spawns multiple processes, the code winds up not being shared betwee...

How do I stop getting ImportError: Could not import settings 'mofin.settings' when using django with wsgi?

I can't get wsgi to import my settings file for my project 'mofin'. The list of errors from the apache error log are as follows mod_wsgi (pid=4001): Exception occurred within WSGI script '/var/www/wsgi-scripts/django.wsgi'. Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 2...

web framework compatible with python 3.1 and py-postgresql

I have started learning Python by writing a small application using Python 3.1 and py-postgresql. Now I want to turn it into a web application. But it seems that most frameworks such as web-py, django, zope are still based on Python 2.x. Unfortunately py-postgresql is incompatible with Python 2.x. Do I have to rewrite all my classes an...

Help with Python in the web

I've been using Werkzeug to make WSGI compliant applications. I'm trying to modify the code in the front page. Its basic idea is that you go to the /hello URL and you get a "Hello World!" message. You go to /hello/ and you get "hello !". For example, /hello/jeff yields "Hello Jeff!". Anyway, what I'm trying to do is putting a form in th...

PyAMF backend choices!

I've been using PyAMF to write a backend for a flex app that will request different groups of hundreds of different images depending on what the client needs. I have been using the "simple_server" WSGI server that PyAMF supplies while developing the flex code. Now I'm ready to write a robust backend that will be able to pull images from ...

nginx with mod_wsgi

I generally run web apps behind nginx with FastCGI. I wanted to experiment with mod_wsgi, however it seems quite out of date. The author mentions that it worked on version 0.5.34, however I'm running 0.7.62 now. The wiki article warns of compilation problems with the module and later versions of nginx. Has anybody used mod_wsgi with ...

How to force the use of SSL for some URL of my Django Application ?

Hello, I want to be sure that for some URL of my website, SSL will be use. I saw a lot of answer already on SO. http://stackoverflow.com/questions/724968/force-redirect-to-ssl-for-all-pages-apart-from-one So I think I will use mod_rewrite. My question is more about how to configure the Virtual Host to run my Django Application over H...

python: parse HTTP POST request w/file upload and additional params

Hello all, The task is simple: on the server side (python) accept an HTTP POST which contains an uploaded file and more form parameters. I am trying to implement upload progress indicator, and therefore I need to be able to read the file content chunk-by-chunk. All methods I found are based on cgi.FieldStorage, which somehow only allo...

Advice on set-up/management of the WSGI stack?

After looking through the many useful and shiny Python frameworks, I find none of them get close to what I need or provide way more than my needs. I'm looking to put something together myself; could define it as a framework, but not full-stack. However, I can't find online what the Python community sees as the correct/standard way to man...

how to process long-running requests in python workers?

Hi, I have a python (well, it's php now but we're rewriting) function that takes some parameters (A and B) and compute some results (finds best path from A to B in a graph, graph is read-only), in typical scenario one call takes 0.1s to 0.9s to complete. This function is accessed by users as a simple REST web-service (GET bestpath.php?f...

X-Sendfile and VERY big files on Apache2

Any filesize over about 4GB is not going to work with the mod_xsendfile for Apache2 (as it sets the content length to a long). I am willing to rewrite it to support this; however, I can find no documentation on how to set content length from the apache api to something larger than a long and thus serve large files through Apache. I know...

How can I make WSGI(Python) stateful?

I'm quite new in Python world. I come from java and ABAP world, where their application server are able to handle stateful request. Is it also possible in python using WSGI? Or stateful and stateless are handled in other layer? ...

Customize login page template for Authkit with Pylons?

I'm new to both Pylons and AuthKit. I have basic authentication via AuthKit working in my application, but I don't know how to customize the template for the login page. The one included with AuthKit is very generic. I found Pylons: Mako Templates in AuthKit, but I thought there might be a more up-to-date solution. ...

Is there a speed difference between WSGI and FCGI?

From the web I've gleaned that WSGI is a CGI for python web development/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don't know the performance difference between the two in reference to the languages python and C/++. ...

Getting Django and Subversion to work together on Dreamhost

Does anyone know how to get Django and Subversion to work together on Dreamhost? I've been following this tutorial to install Django (which uses Passenger WSGI): http://wiki.dreamhost.com/Django After I got Django to work, Subversion stopped working. Has anyone ran into this problem? ...

Tornado and Python 3.x

I really like Tornado and I would like to use it with Python 3, though it is written for Python versions 2.5 and 2.6. Unfortunately it seems like the project's source doesn't come with a test suite. If I understand correctly the WSGI part of it wouldn't be that easy to port as it's spec is not ready for Python 3 yet (?), but I am rather...

How do I copy wsgi.input if I want to process POST data more than once?

In WSGI, post data is consumed by reading the file-like object environ['wsgi.input']. If a second element in the stack also wants to read post data it may hang the program by reading when there's nothing more to read. How should I copy the POST data so it can be processed multiple times? ...

How do I convince mod_proxy_ajp to pass environment variables to its backend?

I'm trying to use Apache's mod_proxy with the AJP backend and an ajp-wsgi app server but it doesn't seem to be sending SetEnv variables to the application server. Configuration snippet: <Location /script> ProxyPass ajp://localhost:8009/script SetEnv FOO "barbobot" </Location> How do I pass environment variables from the Apach...

How does wsgi handle multiple request headers with the same name?

In WSGI headers are represented in the environ as 'HTTP_XXX' values. For example the value Cookie: header is stored at the HTTP_COOKIE key of the environ. How are multiple request headers with the same header name represented? ...

Why should I use WSGI ?

Been using mod_python for a while, I read more and more articles about how good WSGI is, without really understanding why. So why should I switch to it? What are the benefits? Is it hard, and is the learning curve worth it? ...