[google-appengine] Re: Need help with redirection

2011-02-20 Thread Rutwick
Hi Robert,

Thanks for the response!
I have practiced the guestbook app 2 times for learning, and now the
3rd time, as I'm following it for making my own app.

My data comes from some API, where in I'm passing a keyword. My
problem is, I want to use a set of template values commonly throughout
the site, no matter to what URL I'm going to. For example, if I want a
value 'site-header':'Hello!', I want it to be same on all the pages. I
have to pass it every time template.render function renders a page! I
want to do it so that I can have a templating sort of flow for the
site. Like, any where I call {{site-header}}, it should get the same
value.

And one more doubt, how to redirect to a third party site from my app?
I made a tutorial for the app I'm making, and I want to redirect
people to it for learning it. I tried this:
My  has a like to my site: Learn

My main.py file:
app = webapp.WSGIApplication([ ('/', Init),
 ('/learn', Learn)]

class Learn(webapp.RequestHandler):
  def get(self):
 self.redirect('myblog.com')

This isn't working! When I click the link, I get 
http://localhost:8080/myblog.com
in the address bar (I'm working locally) and I tried hard coding the
address, but it doesn't work either!

Am I doing something wrong?

Thanks,
Rutwick

On Feb 18, 4:11 am, Robert Kluin  wrote:
> Hi Rutwick,
>   It sounds like you might want to very carefully and thoroughly go
> through the guestbook app as-is and try to understand how all of the
> pieces work.
>
>   Where does the data for your app come from?  Can you post some code
> showing us what you've tried?
>
> Robert
>
>
>
>
>
>
>
> On Thu, Feb 17, 2011 at 12:23, Rutwick  wrote:
> > Hi GAE Gurus,
>
> > I'm fairly new to GAE. I'm making an APP which gets some data from a
> > RESTful API. My home page has the form to take the keyword for
> > searching, and below that a div which will hold the data returned from
> > the API. The problem is, when someone first opens the homepage, that
> > div will hold a message 'Please enter a keyword', which I'm sending in
> > the 'template_values' dictionary, which also contains the site title,
> > description etc. Once a person enters a keyword and clicks submit, I
> > want the returned data to be displayed in same div. How to I redirect
> > to the homepage on submitting the keyword, along with the returned
> > data and the old values? I'm not using a datastore so I couldn't use
> > the method given in the guestbook app which gets the values from the
> > datastore and if no values are available, shows a message to enter a
> > greeting. 'self.redirect', or the render method wipes out my old
> > values, which include my site title, desc. etc!
>
> > Please someone tell me a method to do it!
>
> > Thanks for any help in advance.
>
> > Rutwick
> > blog.rutwick.com
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google App Engine" group.
> > To post to this group, send email to google-appengine@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-appengine+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Need help with redirection

2011-02-20 Thread Calvin
If you want to redirect somewhere that's outside of your site you need to 
include the protocol ('http://myblog.com').

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Re: Need help with redirection

2011-02-22 Thread djidjadji
Are you sure your redirect request handler is being called?
Put some logging.info("Here-1") calls in your code.

Have you tried  http://localhost:8080/learn

Have you read and understand HTTP and HTML tutorials.

Why not put the external link directly in the  tag

Learn

or in Django templates

Learn

And in your template render function add a

template_values['teach_URL'] = 'http://www.some-site.com'


2011/2/20 Rutwick :
> Hi Robert,
>
> Thanks for the response!
> I have practiced the guestbook app 2 times for learning, and now the
> 3rd time, as I'm following it for making my own app.
>
> My data comes from some API, where in I'm passing a keyword. My
> problem is, I want to use a set of template values commonly throughout
> the site, no matter to what URL I'm going to. For example, if I want a
> value 'site-header':'Hello!', I want it to be same on all the pages. I
> have to pass it every time template.render function renders a page! I
> want to do it so that I can have a templating sort of flow for the
> site. Like, any where I call {{site-header}}, it should get the same
> value.
>
> And one more doubt, how to redirect to a third party site from my app?
> I made a tutorial for the app I'm making, and I want to redirect
> people to it for learning it. I tried this:
> My  has a like to my site: Learn
>
> My main.py file:
> app = webapp.WSGIApplication([ ('/', Init),
>                                                 ('/learn', Learn)]
>
> class Learn(webapp.RequestHandler):
>      def get(self):
>             self.redirect('myblog.com')
>
> This isn't working! When I click the link, I get 
> http://localhost:8080/myblog.com
> in the address bar (I'm working locally) and I tried hard coding the
> address, but it doesn't work either!
>
> Am I doing something wrong?
>
> Thanks,
> Rutwick
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.