Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8392009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:24:26+00:00 2026-06-09T19:24:26+00:00

Alright, i’ve asked this question in the past. However, when I asked it, I

  • 0

Alright, i’ve asked this question in the past. However, when I asked it, I had a limited knowledge of python and app engine. This is most likely why I failed to implement this in the past. I’m attempting to get each profile to be unique based on the username.

Any who, before I dive in, i’ll throw my profile handler up that only deals with currently logged in users at the moment:

class Profile(MainHandler):
    def get(self):
        if self.user:
            current_user = str(self.user.name)
            key = ''
            imgs  = db.GqlQuery("select * from Profile_Images WHERE name =:1", current_user)
            team_name  = db.GqlQuery("select * from Teams WHERE name =:1", current_user)
            team_images  = db.GqlQuery("select * from Teamimg WHERE user =:1", current_user)
        for clan in team_name:
                name1 = clan.team_name_anycase
        for image in team_images:
            team_imagee = image.key()
        if self.user:
            for img in imgs:
                key = img.key()
            self.render('profile.html', team_img = team_imagee, team_name = name1, profile_image = key, username = self.user.name, email = self.user.email, firstname = self.user.first_name, last_name = self.user.last_name, country = self.user.country)
        else:
            self.redirect('/register')

This handler is mapped via (‘profile’, Profile).

Any who, what I understand thus far is that I need to pass the username through the URL and into the profile handler which then uses that username as identifier for pulling data from the db.

What I saw posted on stackoverflow was ('profile/<profile_id>', Profile). And I have been messing around with that for a bit, but it seems that the trailing username (ex.localhost:8080/profile/admin) is getting a 404 error. I would assume that either my mapping is failing, or the variable (i.e. the username) is failing to interact with the profile handler.

Could someone please help me out here? I was sure I had it, and it failed.

YAML file:

application: suitegamer
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /static
  static_dir: static

- url: /img
  static_dir: img

- url: /.*
  script: main.app

libraries:
- name: jinja2
  version: latest

- name: PIL
  version: "1.1.7"

MainHandler:

class MainPage(MainHandler):
    def get(self):
    if self.user:
            self.render('index.html', username = self.user.name, firstname = self.user.first_name)
        else:
            self.render('index.html')

    def post(self):
    username = self.request.get('username').lower()
        password = self.request.get('password')

        u = User.login(username, password)
        if u:
            self.login(u)
            self.redirect('/news_page')
        else:
            msg = 'Invalid login.'
            self.render('login.html', error = msg)

Mapping:

app = webapp2.WSGIApplication([('/', MainPage),
                               ('/logout', Logout),
                               ('/img', GetImage),
                               ('/register', Register),
                               ('/welcome', Welcome),
                               ('/news_page', News_Page),
                               ('/profile', Profile),
                               ('/edit_profile', Edit_Profile),
                               ('/change_profile_image', Change_Profile_Image),
                               ('/found_a_team', Found_Team),
                               ('/team_main', Team_Main),
                               ('/edit_team_main', Edit_Team_Main),
                               ('/edit_team_image', Edit_Team_Image)],
                              debug=True)

Testing Profile Handler:

class Profile(MainHandler):
    def get(self, profile_id):
        profile_id = 'admin'
        if self.user:
            key = ''
            imgs  = db.GqlQuery("select * from Profile_Images WHERE name =:1", profile_id)
            team_name  = db.GqlQuery("select * from Teams WHERE name =:1", profile_id)
            team_images  = db.GqlQuery("select * from Teamimg WHERE user =:1", profile_id)
        for clan in team_name:
                name1 = clan.team_name_anycase
        for image in team_images:
            team_imagee = image.key()
        if self.user:
            for img in imgs:
                key = img.key()
            self.render('profile.html', team_img = team_imagee, team_name = name1, profile_image = key, username = self.user.name, email = self.user.email, firstname = self.user.first_name, last_name = self.user.last_name, country = self.user.country)
        else:
            self.redirect('/register')

Image Handler:

class GetImage(MainHandler):
    def get(self):
        img = db.get(self.request.get("entity_id"))
        self.response.out.write(img.image)

Maps to (‘/img’, GetImage)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:24:27+00:00Added an answer on June 9, 2026 at 7:24 pm

    the mapping should look like this:

    ('/profile/(.*)/?', Profile)
    

    and your Handlers get function should take a parameter which will be the profile id/name

    class Profile(MainHandler):
        def get(self, profile_id):
            # do something with the profile id...
    

    i think you should give the docs a deeper look.
    for example here: https://developers.google.com/appengine/docs/python/tools/webapp/running

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, so this is an extension to a question I asked last night. I
Alright, I'm still a newbie in Perl, so the answer to this question may
Alright, i am new to python, and simple tab creation in this language somewhat
Alright, I found out in this question that polling sockets does not scale, so
Alright I don't see why this isnt working. It seems pretty simple. Here is
Alright, this is driving me nuts because my regex is working on Rubular, but
Alright so I have no idea how to even begin doing this But basically
Alright I created some custom classes for my project sourced from this tutorial ,
Alright, so I got this code for gluLookAt: lookAt = new Vector3f(-player.pos.x, -player.pos.y, -player.pos.z);
Alright, I'll try and make this brief as possible. I wanted to a UIToolbar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.