Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to setup Django with WSGI and Apache on root (/) of the website, but I would like that Apache servers through WSGI (and Django) only those URLs which do not have corresponding file to serve directly.

For PHP I would do something like this with:

RewriteCond %{REQUEST_FILENAME} !-f

and then rewrite to some index.php or something. But how to do that with WSGI?

share|improve this question

This is explained in the mod_wsgi documentation:

Don't use WSGIScriptAlias. Use AddHandler instead and use similar mod_rewrite tricks. A small fixup is required as a WSGI middleware in your WSGI script.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.