python - 404 error on unique page creation with google app engine -


i asked similar question here: create permenant unique links based on user id couldn't quite answer. trying give every user on site unique profile page. have set keep getting 404 error. not sure if problem handler or whole way doing it.

here app code:

app = webapp2.wsgiapplication([('/', mainpage),                                (r'/profile/(.+)', profilepage)]) 

and here profilepage handler class:

class profilepage(webapp2.requesthandler):     def get(self, profile_id):         profileowner = user.get_by_id(profile_id)          if profileowner:             #get posts user , render....             #theid federated_id              theid = profileowner.theid             personalposts = db.gqlquery("select * post theid =:1 order created desc limit 30", theid)              #i collect can have username in top of page             global visits             logout = users.create_logout_url(self.request.uri)             currentuser = users.get_current_user()             self.render('profile.html', user = currentuser, visits = visits, logout=logout, personalposts=personalposts)         else:             self.redirect("/") 

for id of 1201, found in datastore viewer use, have been testing typing in www.url.com/profile/1201 , when 404 error.

update: redirecting me main page amber's suggested change.

now when change line:

profileowner = user.get_by_id(profile_id) 

to this:

profileowner = user.get_by_id(17001) 

it goes through correctly guessing that line not correctly getting profile_id url

r'/profile/<profile_id>' 

is not valid regular expression. want instead:

r'/profile/(.+)' 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -