가능한 중복 :
create unique profile page for each user python사용자 ID를 기반으로 permenant의 고유 링크를 만들
내가 파이썬과 jinja2와 구글 애플리케이션 엔진을 사용하고 내 응용 프로그램 고유에게 각 사용자를 제공하기 위해 노력하고 있어요 로그인하지 않고 누구나 방문 할 수있는 프로필 페이지의 URL입니다.
class ProfilePage(webapp2.RequestHandler):
def get(self, profile_id):
user = User.get_by_id(profile_id)
#profile_id = some unique field
if user:
#Get all posts for that user and render....
theid = user.theid
personalposts = db.GqlQuery("select * from Post where theid =:1 order by created desc limit 30", theid)
else:
personalposts = None
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)
app = webapp2.WSGIApplication([('/', MainPage),
('/profile/([0-9]+)', ProfilePage),])
시험해 보았을 때 404 오류가 나옵니다. 코드가 맞다면 잘못된 테스트 URL을 사용하고있을 수도 있습니다. 예를 들어 이것이 OpenID ID 인 경우 : www.url.com/profile/ https://www.google.com/accounts/o8/id?id=AItOawlILoSKGNwU5RuTiRtXug1l8raLE45g-56을 입력 해 보았을 때 어떻게 테스트 할 수 있습니까? id = "이 부분"은 내가 입력 한 것일뿐입니다.
url = www.url.com/profile/AItOawlILoSKGNwU5RuTiRtXug1l8raLE45g-56
그게 내가 시도한 것이고, 제대로 작동하지 않았다. 도움에 미리 감사드립니다!
비밀 URL이 아니므로 공개하겠습니다. 그것이 모든 사람이 볼 수 있도록하기위한 전체 이유입니다. – exployre
내가 그 일을하고있는 곳입니까? 나는 그것이 무엇을 의미하는지 확실히 모르겠다 ... – exployre