Dreamhost subdirectory via FastCGI

68 views
Skip to first unread message

rppowell

unread,
Sep 15, 2009, 11:30:52 PM9/15/09
to web2py-users
Hey guys;

I'm trying to setup web2py in a subdirectory off of my main www
directory using FastCGI.

I want to use subdirectories and .htaccess to manage and organize
seperate projects, for example:

Directory structure:
www
fastcgi
web2py
...
URL structure:
index.html
fastcgi
web2py
...

I verified that I can use .htaccess and FastCGI to run a simple python
script under the fastcgi directory/URL.

I used a similar setup and configuration to run web2py, except that
web2py still thinks its running from the root URL path.

When I try to go to the web2py base, it redirects to "/welcome/default/
index".
I need to have "/web2py" included in the URL base.

How do I configure web2py to work in the web subdirectory?

-rppowell

Thadeus Burgess

unread,
Sep 16, 2009, 12:28:13 AM9/16/09
to web...@googlegroups.com
Have a look at using WSGI instead, I am currently using it with my web2py on dreamhost, and it runs faster than fastcgi.

Take a look at these articles:

The first one is about WSGI on dreamhost, and the second one has web2py instructions about it near the end of the page.

The last page will most likely be the most help :)

http://wiki.dreamhost.com/Passenger_WSGI
http://wiki.dreamhost.com/Web2py
http://www.web2pyslices.com/main/slices/take_slice/1

And access to the admin securly

http://webhostingreal.com/content/view/20/1/



-Thadeus

Thadeus Burgess

unread,
Sep 16, 2009, 11:16:03 AM9/16/09
to rppowell, web...@googlegroups.com
I am running WSGI on a subdirectory of my home, however you have to run it as the root of the domain (unless you want to try and get fancy with apache conf.)

Basically what I did, was map a subdomain to a directory that stores my website instance.

so i have

thadeusb.com = /home/thadeusb.com
for my wordpress blog (in the middle of migrating to web2py)

web2py.thadeusb.com = /home/thadeusb.com/web2py/
for my web2py blog

-Thadeus




On Tue, Sep 15, 2009 at 11:50 PM, rppowell <rppo...@hotmail.com> wrote:
Hey Thadeus;

I looked at WSGI stuff for a bit, but was unclear on how to have WSGI
in seperate/sub directories.

The important thing I'm working on is having an instance of web2py
running off of a subdirectory off of my web directory, not in the web
directory root.
I found these links as well while trying to figure out to setup
FastCGI with web2py.

I notice that these all assume that web2py is going to be running from
the root directory.
Have you figured out how to use WSGI in a subdirectory off of the root
web directory?

-rppowell

rppowell

unread,
Sep 16, 2009, 1:20:36 PM9/16/09
to web2py-users
Thank you for the information on setting up web2py using WSGI.
I have thing somewhat working on using FastCGI within subdirectories
by using .htaccess and dispatch.cgi.

The only problem I think I'm having with getting web2py working in a
subdirectory with FastCGI is that the URL is missing the subdirectory
base.

For example, when I initially go to the web2py site in the
subdirectory, it tries to redirects to the 'welcome' app:
http://www.rppowell.com/web2py
redirects to:
http://www.rppowell.com/welcome/default/index

The problem is that it is missing the web2py subdirectory; web2py
should be redirecting to:
http://www.rppowell.com/web2py/welcome/default/index

I have verified that going to http://www.rppowell.com/web2py/welcome/default/index
works; it returns valid HTML, except all internal URLs are missing the
'/web2py' and thus images/css is borked.

I think this is something internal to web2py that can be fixed:
simpley prepend 'web2py/' to all the web2py URLs.

How do I do that?

-rppowell
PS: I'm figuring out WSGI setup too, but the documentation has the
same premise as setting up FastCGI: Everything seems to be specified
in a root web directory. Using subdomains side-steps this issue;
you're using the sub-domain name to distinguish which WSGI to use, not
subdirectories. I want to use subdirectories/URLs to organize/specify
which instance of web2py/django/whatnot, to be used all within the
same domain.

Thadeus Burgess

unread,
Sep 16, 2009, 6:11:48 PM9/16/09
to web...@googlegroups.com
Take a look at the routes.py, I don't know much about it, but there is documentation on it in the book.

-Thadeus

mdipierro

unread,
Sep 16, 2009, 6:35:28 PM9/16/09
to web2py-users
#In routes.py

routes_in=(('/web2py/(?P<a>.*)','/\g<a>'),)
routes_out=(('/(?P<a>.*)','/web2py/\g<a>'),)

On Sep 16, 5:11 pm, Thadeus Burgess <thadeus.burg...@gmail.com> wrote:
> Take a look at the routes.py, I don't know much about it, but there is
> documentation on it in the book.
>
> -Thadeus
>
Reply all
Reply to author
Forward
0 new messages