Problem with Wiki site under Apache using mod_WSGI

53 views
Skip to first unread message

cht8

unread,
Oct 13, 2012, 10:08:27 PM10/13/12
to turbo...@googlegroups.com
Hey,
    I've deployed the 20 minute Wiki site using mod_WSGI. The page display fine and I can click on the edit button.
However, when I try to save the page, it doesn't work. It doesn't even redirect me to the proper address I've set it. It keeps redirects me to /save instead of /FrontPage like the guide said.

Any helps would be great. Thanks.

cht8

unread,
Oct 14, 2012, 1:23:40 AM10/14/12
to turbo...@googlegroups.com
I meant I used mod_WSGI to deploy the wiki site under Apache.

Christoph Zwerschke

unread,
Oct 14, 2012, 4:19:11 AM10/14/12
to turbo...@googlegroups.com
Which version of TG did you use, and which version of the wiki tutorial?
Did it work in development mode with the paste server, but not with
mod_wsgi, or did it never work?

Please need to provide more info if you want people to help.

-- Christoph

cht8

unread,
Oct 14, 2012, 8:53:22 PM10/14/12
to turbo...@googlegroups.com
I used TG 2.1.4 following the wiki guide on


It didn't work with the paste server because of how my school's virtual network is setup. This is why I switched to mod_wsgi and apache.

The page display fine and everything. But when I clicked the save button to call the method defined in root.py, it doesn't work properly. It suppose to modify the page and redirects me back to /'pagename" but instead it constantly redirects me back to "/save".

I tried modifying the redirect line in root.py to a static address but it doesn't work.

Thanks.

Michael Pedersen

unread,
Oct 14, 2012, 10:15:48 PM10/14/12
to turbo...@googlegroups.com
What appears in the log file, if anything?

The behavior sounds like there's a validation error, resulting in the
page redirecting back tot he save form. Is validation passing
correctly for you? How have you verified this?
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/bcjB4oFkUtUJ.
>
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to
> turbogears+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.



--
Michael J. Pedersen
My Online Resume: http://www.icelus.org/ -- Google+ http://plus.ly/pedersen
Google Talk: m.ped...@icelus.org -- Twitter: pedersentg

cht8

unread,
Oct 15, 2012, 2:08:44 AM10/15/12
to turbo...@googlegroups.com
Hi,
   I've checked the apache error log. There's no error except saying the /save is not found. I can't find any logs in the project folder or the virtualenv folder.
   How do you check for validation?

Thanks


On Saturday, October 13, 2012 7:08:27 PM UTC-7, cht8 wrote:

Christoph Zwerschke

unread,
Oct 15, 2012, 2:48:12 AM10/15/12
to turbo...@googlegroups.com
Am 15.10.2012 02:53, schrieb cht8:
> I used TG 2.1.4 following the wiki guide on
> http://www.turbogears.org/book/part1/wiki20.html#installing-the-development-tools
>
> For mod_wsgi, I followed
> http://turbogears.org/2.1/docs/main/Deployment/ModWSGI.html#apache-mod-wsgi.

If you newly try out TurboGears, you should use 2.2 instead of 2.1.

> It didn't work with the paste server because of how my school's virtual
> network is setup. This is why I switched to mod_wsgi and apache.

This should always work at least with the loopback interface
(127.0.0.1), no matter which network. The usual way is to develop and
test an application locally with the paste server. Only then you make
the next step and deploy it via mod_wsgi. The recipes for mod_wsgi also
usually assume production mode, so you will have less debugging info
available (in terms of logs, tracebacks in the browser, debug bar).

> The page display fine and everything. But when I clicked the save button
> to call the method defined in root.py, it doesn't work properly. It
> suppose to modify the page and redirects me back to /'pagename" but
> instead it constantly redirects me back to "/save".

Redirects you back? If you click "save" you should be already there. It
should store the page (does it do that?) and then redirect you.

I recommend you first try it out in development mode without mod_wsgi,
and if that does not work, show us your save controller and
logs/tracebacks if there are any errors.

-- Christoph

Christoph Zwerschke

unread,
Oct 15, 2012, 2:55:08 AM10/15/12
to turbo...@googlegroups.com
Am 15.10.2012 08:08, schrieb cht8:
> I've checked the apache error log. There's no error except saying
> the /save is not found. I can't find any logs in the project folder or
> the virtualenv folder.

If /save is not found, then it certainly cannot redirect you, because
the redirection happens in the save controller.

Maybe you have forgotten the @expose(), or something is wrong with your
indentation for the save method (use an editor that can show whitespace
and look if everything lines up properly).

-- Christoph

cht8

unread,
Oct 15, 2012, 3:27:42 AM10/15/12
to turbo...@googlegroups.com
I am using 2.2 actually.
The reason I'm using mod_wsgi and Apache is because the development method with paster server doesn't work. I have it deployed and it says "serving on http://127.0.0.1:8080".
When I open another terminal and telnet to 127.0.0.1 8080 I can get a proper main page response.

However my school's got it set up so that we have to go through a gateway machine and it will forward the request to our virtual machine. When I access the 127.0.0.1:8080 on our virtual machine through the gateway, it doesn't work.
Weird thing is, 1.0 and 1.5 works fine with cheerypy, the page displays.

The save method is correct because I have exactly the same site set up on my personal ubuntu 12.04 and I have no trouble accessing it. But if I try to access it through the browser with http://my_ip:8080 it doesn't work too.

It doesn't save the page because I manually go to the editing page after ward and it's still the same.
It's not suppose to redirect me to /save it's suppose to redirect me back to the page I was editing.
I was following the guide exactly except under apache port 80 and some URL differences that's it.

Thanks in advance for the helps

Christoph Zwerschke

unread,
Oct 15, 2012, 3:49:50 AM10/15/12
to turbo...@googlegroups.com
Am 15.10.2012 09:27, schrieb cht8:
> I am using 2.2 actually.
> The reason I'm using mod_wsgi and Apache is because the development
> method with paster server doesn't work. I have it deployed and it says
> "serving on http://127.0.0.1:8080".
> When I open another terminal and telnet to 127.0.0.1 8080 I can get a
> proper main page response.
>
> However my school's got it set up so that we have to go through a
> gateway machine and it will forward the request to our virtual machine.

Maybe the problem is that your browser runs on a terminal server and not
on the machine where your are developing? Or it is using a proxy even
for the lookback address? Something like that?

If you can only have a browser on a different machine, you can still use
the paster server and the development mode. Just open your
development.ini and where it says 127.0.0.1 enter nothing or the IP
address of the machine. Then the development server can be contacted
from other machines.

> When I access the 127.0.0.1:8080 on our virtual machine through the
> gateway, it doesn't work.
> Weird thing is, 1.0 and 1.5 works fine with cheerypy, the page displays.

Yes, that's strange.

> The save method is correct because I have exactly the same site set up
> on my personal ubuntu 12.04 and I have no trouble accessing it. But if I
> try to access it through the browser with http://my_ip:8080 it doesn't
> work too.

That's because development.ini by default does not serve on my_ip:8080,
but only on localhost:8080, for security reasons.

-- Christoph

cht8

unread,
Oct 15, 2012, 9:53:55 AM10/15/12
to turbo...@googlegroups.com
I changed the host to the IP of the virtual machine and it worked! without mod_wsgi.
Thank you so much :D
Reply all
Reply to author
Forward
0 new messages