Quantcast
Channel: Admins Goodies » cherrypy
Viewing all articles
Browse latest Browse all 5

mod_wsgi + cherrypy = 404 – The path ‘/index.wsgi/’ was not found

$
0
0

Question

The .htaccess :

AddHandler wsgi-script .wsgi
RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.wsgi/$1 [QSA,L,PT]

The index.wsgi :

import atexit
import threading
import cherrypycherrypy.config.update({'environment': 'embedded'})if cherrypy.engine.state == 0:
        cherrypy.engine.start(blocking=False)
        atexit.register(cherrypy.engine.stop)class Root:
        def index(self):
            return "..."
            index.exposed = True    def default(self):
            return "default"
                index.exposed = Trueapplication = cherrypy.tree.mount(Root(), "/")
  • It is a shared host, i don’t have access to apache
  • I’m not allowed to use WSGIScriptAlias

The 404 error comes from cherrypy(powered by cherrypy on the botton), so i conclude apache is calling the .wsgi file correctly, it seems that its also passing /index.wsgi/, and cherrypy does not know what to do with it.

Can anyone help me with this?

I never deployed a cherrypy app before, is this the best/only/recommended way to do it?

Thanks in advance.

Answer

If setting RewriteBase to ‘/’ in .htaccess, likely that you need to use:

RewriteRule ^(.*)$ /index.wsgi$1 [QSA,L,PT]

Viewing all articles
Browse latest Browse all 5

Trending Articles