I am using gae with django.
I have an project named MusicSite with following url mapping-

urls.py

from django.conf.urls.defaults import *
from MusicSite.views import MainHandler
from MusicSite.views import UploadHandler
from MusicSite.views import ServeHandler

urlpatterns = patterns('',(r'^start/', MainHandler),
         (r'^upload/', UploadHandler),
         (r'^/serve/([^/]+)?', ServeHandler),
)

There is an application MusicSite inside MusicFun with the following
codes-

views.py

import os
import urllib

from google.appengine.ext import blobstore
from google.appengine.ext import webapp
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app

def MainHandler(request):
      response=HttpResponse()
      upload_url = blobstore.create_upload_url('http://localhost:
8000/upload/')
      response.write('<html><body>')
      response.write('<form action="%s" method="POST"
enctype="multipart/form-data">' % upload_url)
      response.write("""Upload File: <input type="file"
name="file"><br> <input type="submit"
          name="submit" value="Submit"> </form></body></html>""")
      return HttpResponse(response)

def UploadHandler(request):
      upload_files=request.FILES['file']
      blob_info = upload_files[0]
      response.redirect('http://localhost:8000/serve/%s' %
blob_info.key())

class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler):
  def get(self, resource):
      resource = str(urllib.unquote(resource))
      blob_info = blobstore.BlobInfo.get(resource)
      self.send_blob(blob_info)


now whenever a upload a file using http://localhost:8000/start and
click Submit i am taken to a blank page with the following url-

http://localhost:8000/_ah/upload/ahhnb29nbGUtYXBwLWVuZ2luZS1kamFuZ29yGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxgHDA

These random alphabets keep varying but the result is same. A blank
page after every upload.
Somebody please help.

The server responses are as below-

INFO:root:"GET /start/ HTTP/1.1" 200 -
INFO:root:"GET /favicon.ico HTTP/1.1" 404 -
INFO:root:Internal redirection to http://localhost:8000/upload/
INFO:root:Upload handler returned 500
ERROR:root:Invalid upload handler response. Only 301, 302 and 303
statuses are permitted and it may not have a content body.
INFO:root:"POST /_ah/upload/
ahhnb29nbGUtYXBwLWVuZ2luZS1kamFuZ29yGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxgCDA
HTTP/1.1" 500 -
INFO:root:"GET /favicon.ico HTTP/1.1" 404 -

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

Reply via email to