So far I've only found one minor problem with this.
In my example above, the links to other apps in the admin app wont
work.
For example clicking the app2 should redirect to www.myhost.com/subdir/app2,
but it redirects to www.myhost.com/app2 and results to Not Found.
Other than that, all editing works fine.
I tried to edit routes.py for admin like this, but it didn't have any
effect on the link.
routes_out = (('/app2/$any', '/subdir/app2/$any'),)
On Feb 22, 8:33 am, Kimmo <[email protected]> wrote:
> Hi,
>
> I want to deploy web2py in a way that people would be able to develop
> apps and freely put them in any directory under /var/www, but they are
> not allowed to access httpd.conf. (kind of like shared hosting) Also
> when browsing to the root of host, it would not be web2py app.
>
> So I came up with this:
>
> web2py is in directory /var/www/web2py
>
> In httpd.conf I have this configuration for web2py:
>
> WSGIDaemonProcess web2py user=www-data group=www-data display-name=%
> {GROUP}
> WSGIProcessGroup web2py
> <Directory /var/www/web2py>
> SetHandler wsgi-script
> Options ExecCGI
> AllowOverride None
> Order Allow,Deny
> Deny from all
> <Files wsgihandler.py>
> Allow from all
> </Files>
> </Directory>
> <Directory /var/www/web2py/applications/*/static/>
> Order Allow,Deny
> Allow from all
> </Directory>
>
> There is app1, app2 and admin applications installed in web2py. I want
> them to be deployed in the following URLs:
>
> www.myhost.com/app1www.myhost.com/subdir/app2www.myhost.com/admin
>
> So I create directories like this:
> /var/www/app1
> /var/www/subdir/app2
> /var/www/admin
>
> In each directory I then put .htaccess file containing something like
> this (example is for app2, other directories would have appropriate
> directories ofcourse):
>
> RewriteEngine On
> RewriteRule ^(.*)$ /var/www/web2py/wsgihandler.py/app2/$1
> (also could have redirection to serve static files straight)
>
> Then each app would have app specific routes.py with something like
> this (example is for app2, other directories would have appropriate
> directories ofcourse):
>
> routes_out = ((r'/$anything', r'/subdir/$anything'),)
>
> If the developer wanted to move the app to some other directory, he
> would just move the created directory with .htaccess and then edit the
> app's routes.py to accommodate the new directory.
>
> And if there would be a new app, it could be placed freely in any
> subdirectory and have control of the routing in the application.
>
> With this type of deployment the app developer could handle routing
> and other things without server admin having to worry people fiddling
> around with httpd.conf and this would minimize the need to restart the
> server so often.
> I probably missed some details in the setup, but I hope everyone got
> the idea.
>
> I managed to get this working on my test server, but is there reasons
> why I shouldn't do this?