My guess would be to use a rule that looks something like:
('/path/to/site/(?P<path>[\w\./_-]+)','/\g<path>')
Basically we want web2py to think that it is working at '/' when in fact
it is working at '/path/to/site/'
Try that.
-tim
richard.ree wrote:
> For those interested I made some progress on my dreamhost issues. The
> following .htaccess launches web2py (/path/to/site/ is where
> dispatch.fcgi and .htaccess reside):
>
> Options +ExecCGI
> AddHandler fastcgi-script .fcgi
> RewriteEngine On
> RewriteBase /path/to/site/
> RewriteRule ^dispatch\.fcgi/ - [L]
> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>
> I want to see www.mydomain.net/myser/path/to/site/welcome/default/index,
> but instead it redirects to www.mydomain.net/welcome/default/index. I
> tried to figure out how to use routes to solve this - can anyone help?
>
> thanks!
> -Rick
>
> On Jan 7, 3:15 pm, "richard.ree" <[email protected]> wrote:
>
>> The permissions checked out, but I still get the same error html
>> snippet. The problem seems to be with the last line in .htacces:
>>
>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>
>> If I comment it out, I get the directory index where dispatch.fcgi
>> and .htaccess are.
>>
>> Other content from ~/www is served ok, unless I put .htaccess in ~/www
>> - then it all gets blocked with the same error message.
>> I tried putting dispatch.fcgi and .htaccess in a subdirectory, ~/www/
>> w2p - this solves the problem for ~/www but not for ~/www/w2p.
>>
>> Sorry this thread is not really web2py related, but it might help
>> others use it ondreamhost...
>>
>> On Jan 7, 1:50 pm, Timothy Farrell <[email protected]> wrote:
>>
>>
>>> Oops, I overlooked that last import in my attachment. You were right to
>>> fix it how you did.
>>> Your step 3 tells me that it's working. This is roughly what I get when I
>>> run mine. Now it's just a matter of getting Apache to recognize your
>>> dispatch.fcgi. Things to check:
>>> - permissions:
>>> $ chmod 664 .htaccess
>>> $ chmod 755 dispatch.fcgi
>>> $ chown <your username> ~/www/*
>>> $ chgrp <your usergroup> ~/www/*
>>> Try that and giveDreamhost'sfcgi daemon 10 minutes to notice the changes.
>>> Let me know if we need to fiddle some more.
>>> -tim
>>> richard.ree wrote:I followed your steps but got the following errors. 1.
>>> The .htaccess file causes this snippet of html to be returned for all
>>> requests: <html><body>Error</body></html> 2. When I run dispatch.fcgi
>>> unmodified, it bails with "ImportError: No module named fcgi" even though
>>> the import from gluon.contrib.gateways is successful (I can print it, dir()
>>> it, and so on) 3. I modify dispatch.fcgi to import WSGIServer as "from
>>> gluon.contrib.gateways.fcgi import WSGIServer" - this runs, but then I get
>>> the following:WARNING:root:unable to import dbhash WSGIServer: missing
>>> FastCGI param REQUEST_METHOD required by WSGI! WSGIServer: missing FastCGI
>>> param SERVER_NAME required by WSGI! WSGIServer: missing FastCGI param
>>> SERVER_PORT required by WSGI! WSGIServer: missing FastCGI param
>>> SERVER_PROTOCOL required by WSGI! Status: 303 SEE OTHER Content-Type:
>>> text/html Location: /welcome/default/index Content-Length: 66 You are being
>>> redirected <a href="/welcome/default/index">here</a> <<< I realize I can
>>> ignore the WSGIServer errors, but what about the 303 status? Strange. I
>>> tried google and thedreamhostwiki and forums for answers but no luck.
>>> Thanks for your help. -Rick On Jan 7, 7:57 am, Timothy
>>> Farrell<[email protected]>wrote:I have mine working like this: 1) Extract
>>> web2py to ~/web2py 2) Place the attached dispatch.fcgi in your webroot
>>> (~/www you said) 3) Modify dispatch.fcgi to point to the right directories
>>> in your situation 4) Place the attached htaccess file in your webroot.
>>> (Make sure you rename it to .htaccess ) No need to run web2py, FastCGI
>>> takes care of it. I've had some trouble with routes with this setup, but
>>> I'm not sure if it's me or the setup. =) Let me know if that doesn't work
>>> for you. One thing to note is that you must specify python2.5 (1st line in
>>> dispatch.fcgi) becausedreamhost'sdefault `python` points to python 2.4.4
>>> -tim richard.ree wrote:Anyone running web2py ondreamhost? I folllowed the
>>> instructions athttp://wiki.dreamhost.com/Web2pybut couldn't figure out how
>>> to adapt them to my case. I have a shell account but not a WebID so I have
>>> no access to the control panel. In my home directory, web content is served
>>> from ~/www, which is visible aswww.mydomain.net/myusername. I'd like to set
>>> up web2py such that it's accessible as,
>>> e.g.,www.mydomain.net/myusername/web2py, or better yet, have a specific
>>> web2py application visible aswww.mydomain.net/myusername/myapp. On another
>>> server where I control apache I used ProxyPass directives to do this. Is it
>>> a matter of using the wsgi handler? I can start web2py on
>>> thedreamhostserver and tunnel port 8000 to my local machine - this works -
>>> butwww.mydomain.net:8000does not. Thanks in advance for any suggestions,
>>> -Rick-- Timothy Farrell<[email protected]>Computer Guy Statewide General
>>> Insurance Agency (www.swgen.com) [htaccess< 1K ]RewriteEngine On
>>> RewriteBase / RewriteRule ^dispatch\.fcgi/ - [L] RewriteRule ^(.*)$
>>> dispatch.fcgi/$1 [L] [dispatch.fcgi< 1K ]#!/usr/bin/env python2.5 import os
>>> import sys os.chdir('/home/<username>/web2py')
>>> path=os.path.normpath('/home/<username>/web2py/') if not path in sys.path:
>>> sys.path.append(path) import gluon.main import gluon.contrib.gateways.fcgi
>>> as fcgi application=gluon.main.wsgibase if __name__ == '__main__': from
>>> fcgi import WSGIServer WSGIServer(application).run()-- Timothy
>>> Farrell<[email protected]>Computer Guy Statewide General Insurance Agency
>>> (www.swgen.com)
>>>
> >
>
--
Timothy Farrell <[email protected]>
Computer Guy
Statewide General Insurance Agency (www.swgen.com)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---