2 web.py apps on a box - seeing apache errors

92 views
Skip to first unread message

Megha Vishwanath

unread,
Sep 18, 2012, 2:49:47 AM9/18/12
to we...@googlegroups.com, d...@klp.org.in
Hi,

We've noticed this error in our apache logs. We have two web.py apps deployed on the same box one at  /srv/www_app  and the other at /srv/misc/modinterface

Their apache configs are separate and they run on different ports even. Their interaction with each other is limited. When content is added on www_app, it gets moderated via the modinterface app. They both talk to a common database where moderation flags get set.

However as you can see below, in a completely unrelated context, the os path in the www_app is referring to the path of the moderator interface. Are there any apache/ mod wsgi config guidelines we've missed in deploying two web.py apps one beside the other on this box.

Tue Sep 18 11:03:51 2012] [error] Traceback (most recent call last):
[Tue Sep 18 11:03:51 2012] [error]   File "/srv/www_app/klp.wsgi", line 1298, in GET
[Tue Sep 18 11:03:51 2012] [error]     dirList=os.listdir(os.getcwd() + path + "/demographics/English")
[Tue Sep 18 11:03:51 2012] [error] OSError: [Errno 2] No such file or directory: '/srv/misc/modinterface/reports/demographics/English'

Regards,
Megha 


Megha Vishwanath

unread,
Sep 18, 2012, 3:03:48 AM9/18/12
to we...@googlegroups.com, d...@klp.org.in
Just to add, these are versions for Apache/mod_wsgi/python

Apache/2.2.22 (Debian) mod_wsgi/3.3 Python/2.7.3rc2

Marios Zindilis

unread,
Sep 21, 2012, 2:56:22 AM9/21/12
to we...@googlegroups.com
Are the two applications running under the same domain? There are some
complications in WSGI function if they are.

I managed to run multiple web.py apps, described in this previous list
message:

https://groups.google.com/forum/#!topic/webpy/CKC5EeXlk_I


On 09/18/2012 10:03 AM, Megha Vishwanath wrote:
> Just to add, these are versions for Apache/mod_wsgi/python
>
> *Apache/2.2.22 (Debian) mod_wsgi/3.3 Python/2.7.3rc2
> *
> On Tue, Sep 18, 2012 at 12:19 PM, Megha Vishwanath
> <megha.vi...@gmail.com <mailto:megha.vi...@gmail.com>> wrote:
>
> Hi,
>
> We've noticed this error in our apache logs. We have two web.py apps
> deployed on the same box one at */srv/www_app* and the other at
> */srv/misc/modinterface*
> *
> *
> Their apache configs are separate and they run on different ports
> even. Their interaction with each other is limited. When content is
> added on www_app, it gets moderated via the modinterface app. They
> both talk to a common database where moderation flags get set.
>
> However as you can see below, in a completely unrelated context, the
> os path in the www_app is referring to the path of the moderator
> interface. Are there any apache/ mod wsgi config guidelines we've
> missed in deploying two web.py apps one beside the other on this box.
>
> Tue Sep 18 11:03:51 2012] [error] Traceback (most recent call last):
> [Tue Sep 18 11:03:51 2012] [error] File "*/srv/www_app/*klp.wsgi",
> line 1298, in GET
> [Tue Sep 18 11:03:51 2012] [error]
> dirList=os.listdir(os.getcwd() + path + "/demographics/English")
> [Tue Sep 18 11:03:51 2012] [error] OSError: [Errno 2] No such file
> or directory: *'/srv/misc/modinterface/*reports/demographics/English'
>
> Regards,
> Megha
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "web.py" group.
> To post to this group, send email to we...@googlegroups.com.
> To unsubscribe from this group, send email to
> webpy+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.


--
Sent from my Thunderbird,
Marios Zindilis

Megha Vishwanath

unread,
Jan 29, 2013, 6:31:26 AM1/29/13
to we...@googlegroups.com
Hi Mario,

Sorry, we're only trying this now, after very long.

And changes suggested here didn't work for us. Do we need to make changes in the wsgi file as well? 

Yes, they run under the same domain. If we resolve this, will it still be a problem then? 

-Megha


For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.


--
Sent from my Thunderbird,
Marios Zindilis

--
You received this message because you are subscribed to the Google Groups "web.py" group.
To post to this group, send email to we...@googlegroups.com.
To unsubscribe from this group, send email to webpy+unsubscribe@googlegroups.com.

Jason Macgowan

unread,
Jan 29, 2013, 6:34:08 AM1/29/13
to we...@googlegroups.com
Can you post your apache config files?


To unsubscribe from this group and stop receiving emails from it, send an email to webpy+un...@googlegroups.com.

To post to this group, send email to we...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Megha Vishwanath

unread,
Jan 29, 2013, 9:13:21 AM1/29/13
to we...@googlegroups.com
This:

For App 1
<VirtualHost *:80>
    ServerName www.domain.com

    RewriteEngine On
    RewriteCond %{THE_REQUEST} /schoolpage/
    RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]

    CustomLog /srv/domwww/logs/access.log common
    ErrorLog /srv/domwww/logs/error.log

    Alias /css /srv/domwww/css
    Alias /images /srv/domwww/images
    Alias /reports /srv/reports
    Alias /rawdata /srv/rawdata
    Alias /uploaded_images /srv/uploaded_images
    Alias /js /srv/domwww/js
    Alias /yui /srv/domwww/yui
    Alias /flot /srv/domwww/flot
    Alias /sslc /srv/domwww/sslc
    Alias /robots.txt /srv/domwww/robots.txt
    
    <Directory /srv/domwww/>
   WSGIApplicationGroup %{GLOBAL}
   AddHandler wsgi-script .wsgi
   allow from all
   </Directory>
</VirtualHost>

For App 2
<VirtualHost *:8005>
    ServerName www.domain.com

    LogLevel debug

    CustomLog /srv/domMisc/modinterface/logs/access.log common
    ErrorLog /srv/domMisc/modinterface/logs/error.log


    Alias /css /srv/domMisc/modinterface/css
    Alias /js /srv/domMisc/modinterface/js
    Alias /images /srv/domMisc/modinterface/images
    Alias /templates /srv/domMisc/modinterface/templates
    Alias /favicon.ico /srv/domMisc/modinterface/favicon.ico
    Alias / /srv/domMisc/modinterface/modinterface.wsgi

    <Directory /srv/domMisc/modinterface>
        AddHandler wsgi-script .wsgi
        WSGIApplicationGroup %{GLOBAL}
        Allow from all
    </Directory>
</VirtualHost>

Marios Zindilis

unread,
Jan 30, 2013, 1:43:51 AM1/30/13
to we...@googlegroups.com
Maybe the problem is that you have two VirtualHost definitions for the same domain. I have posted my current working VirtualHost configuration here:


The only difference to the configuration in production is that the domain is not actually example.com, and the IP from which the test applications are accessible is that of our proxy server.

Let me know if further explanations are necessary.




--
You received this message because you are subscribed to the Google Groups "web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webpy+un...@googlegroups.com.
To post to this group, send email to we...@googlegroups.com.
Visit this group at http://groups.google.com/group/webpy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Marios Zindilis

Megha Vishwanath

unread,
Jan 30, 2013, 4:46:26 AM1/30/13
to we...@googlegroups.com
Hey,

I see that in your set up perhaps one may approach the different apps using example.com/books or example.com/blog, is that right?

I don't want the second app to render on port 80 and these are 2 very distinct web py apps and have nothing to do with each other.
So, would you recommend I use a different Domain name for the second application?

-Megha

Marios Zindilis

unread,
Jan 30, 2013, 7:05:43 AM1/30/13
to we...@googlegroups.com
Oops, I didn't notice that you were using different ports for different applications. 

I made a couple of quick tests, of course Apache can listen on multiple ports and WSGI apps can run on different ports, so here's what I did to (kind of...) simulate your setup:
 
1. Added "Listen 8080" to my Apache configuration.
2. Copied my working VirtualHost definition to a new file, changed the port to 8080 in that file.
3. Restarted apache.

With the above setup I had two VirtualHost definitions, like the one I posted earlier, which were identical to each other, apart from the line:

<VirtualHost *:80> 

Which was in the second file:

<Virtualhost *:8080>

With this setup, every web.py app is served on _both_ ports. Then:
1. I commented out the "blog" application from the <VirtualHost *:80> (The "alias" line and the Directory definition)
2. I commented out every other application except "blog" from the <VirtualHost *:8080>
3. Restarted Apache.

This way, all applications were served on port 80, except "blog" which was on port 8080. I hope this is clear enough. Try to replicate my setup on your server, and monitor your error logs for hints on what might be going wrong.


Marios Zindilis

unread,
Jan 30, 2013, 7:09:02 AM1/30/13
to we...@googlegroups.com
Also, to answer to your questions:

You said:
> I see that in your set up perhaps one may approach the different apps using example.com/books or example.com/blog, is that right?

Yes, /books and /blog are completely separate applications. different database, different files, and _each_ has its own:
application = web.application(urls, globals()).wsgifunc()

You said:
> I don't want the second app to render on port 80 and these are 2 very distinct web py apps and have nothing to do with each other.
> So, would you recommend I use a different Domain name for the second application?

It seems that you can do what you want with just one domain name, but a different one, or a subdomain (separate VirtualHost, port 80), would simplify the situation. 
Reply all
Reply to author
Forward
0 new messages