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 8134869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:12:12+00:00 2026-06-06T10:12:12+00:00

I need to impl a few basic features in this server: display a nice

  • 0

I need to impl a few basic features in this server:

  1. display a nice main screen(html) with < select > widget and 2 buttons(one to choose a image from hd to upload and another to send) + TextEditBox for typing a msg
  2. when the user clicks ‘send’ – take the users choice from the select widget and
  3. the image will be uploaded

I have managed to implement all of it separately, now when I come to make it all work together I have a problem with app.yaml url paths due to a bad design.

app.yaml looks like:

runtime: python    

handlers:
- url: /(.+)
  static_files: images/\1
  upload: images/(.*)

- url: /.*
  script: kserver.py

kserver.py:

class StartPage(webapp.RequestHandler):
    def get(self):
        select_items = db.GqlQuery( "SELECT * FROM Registration" )
        upload_url = blobstore.create_upload_url('/upload')
        self.response.out.write(template.render("tst.html", {'select_items': select_items}))

class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
    def post(self):
        upload_files = self.get_uploads('file')
        image = self.request.get("img")
        photo = Photo()
        photo.imageblob = db.Blob(image)
        photo.put()
        blob_info = upload_files[0]
        self.redirect('/serve/%s' % blob_info.key())

class DownloadImage(webapp.RequestHandler):
    def get(self):
        photo= db.get(self.request.get("photo_id"))
        if photo:
            self.response.headers['Content-Type'] = "image/jpeg"
            self.response.out.write(photo.imageblob)
        else:
            self.response.out.write("Image not available")

class Sender(webapp.RequestHandler):
    def post(self):
        ...
        ...
        self.response.headers['Content-Type'] = 'text/html'     # reply with 200 OK
        self.response.set_status( 200,"OK" )
        ...
        ...

class TokenService(webapp.RequestHandler):
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.set_status( 200,"Registration accepted" )
        ...

application = webapp.WSGIApplication([('/', StartPage),
                                      ('/sender',Sender),
                                      ('/upload', UploadHandler),
                                      ('/i', DownloadImage),
                                      ('/serve/([^/]+)?', ServeHandler),
                                      ('/token',TokenService)],
                                      debug=True)
def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

This is the tst.html :

<html>
    <body>
        <select name="accountName">
            <option value=\"ALL\">ALL</option>
            {% for item in select_items %}
        <option value="{{ item.accountName }}">{{ item.accountName }}</option>
            {% endfor %}
        </select>
        <form action="sender" method="POST">
            <input  type="text" id="TextEditBox_1">
            <input  type="submit" name="submit">
            <input  type="file" name="img" id="Choose_file">
        </form>
    </body>
</html>

note, Identation is fine, its only parts of code.

in the project, i have a images directory that contains app.ico and backgroung image (statics)

Okay, now the problem is i get in GAE logs :

Static file referenced by handler not found: images/token
Static file referenced by handler not found: images/sender

this is not intended. it should be in ‘/’ i think

and

"/token 404 48ms 0kb            No handlers matched this URL."

in addition, when clicking on “send” it redirects me to a new page with :

The requested URL /sender was not found on this server.

this /token is a POST coming from outside to register to the server – the server than store registrations in db. when “send” button pressed ,it should use this db.register tokens.

any comments on the subject is most welcome. thanx!

  • 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-06T10:12:13+00:00Added an answer on June 6, 2026 at 10:12 am

    The patterns in your app.yaml are too general:

    - url: /(.+)
      static_files: images/\1
      upload: images/(.*)
    

    will match just about anything, so the requests that are meant to be handled by code never get there. Try something like this:

    - url: /(.*\.(gif|png|jpg))
      static_files: static/\1
      upload: static/(.*\.(gif|png|jpg))
    

    which will handle only files that end with gif, png or jpg.

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

Sidebar

Related Questions

I need to do this in nhibernate QueryOver: select distinct sc.* from [Security].[Commands] sc
Need to apply a filter to a file like this: TUPAC_0006:1:1:2554:2356#0/1 0 * 0
Need a map reduce function by mongo in php This my mongo structure [_id]
Need just a push in the right direction with this. I'm building a multi-language
Quick background. CFHTTP doesn't support Windows NTLM/Authenticate authentication, only basic authentication. I need to
I need do start the derby server from my java application using org.apache.derby.drda.NetworkServerControl class.
What I really need is an equivalent of this from Eclipse with Netbeans: I
I'm working on a web service client which need to communicate with a server
What configuration parameters or session preferences do I need to set to fix this?
I have a non-wcf server that I call from WCF client and I need

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.