Last active
December 31, 2015 04:29
Revisions
-
jimmykane revised this gist
Dec 12, 2013 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,11 +13,17 @@ template_env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.getcwd())) class MainPageHandler(webapp2.RequestHandler): def get(self): # Do your stuff here pass class UploadFormHandler(webapp2.RequestHandler): def get(self): upload_url = blobstore.create_upload_url('/upload/') template = template_env.get_template('blob.html') context = { 'upload_url': upload_url -
jimmykane revised this gist
Dec 12, 2013 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,10 +13,6 @@ template_env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.getcwd())) class UploadFormHandler(webapp2.RequestHandler): def get(self): -
jimmykane revised this gist
Dec 12, 2013 . 1 changed file with 9 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,43 +2,31 @@ @author: Dimitrios Kanellopoulos @contact: jimmykane9@gmail.com ''' import os import logging import webapp2 import jinja2 from google.appengine.ext import blobstore template_env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.getcwd())) def get(self): #Here goes anything you want on / class UploadFormHandler(webapp2.RequestHandler): def get(self): upload_url = blobstore.create_upload_url('/upload/') template = template_env.get_template('blob.html') context = { 'upload_url': upload_url } self.response.write(template.render(context)) class UploadFormHandler(webapp2.RequestHandler): @@ -57,7 +45,7 @@ def post(self): ("/upload/", UploadFormHandler), ('/upload/picture/', PictureUploadHandler), ],debug=True) -
jimmykane created this gist
Dec 12, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ ''' @author: Dimitrios Kanellopoulos @contact: jimmykane9@gmail.com ''' import logging import webapp2 import jinja2 import os import webapp2 import jinja2 from google.appengine.ext import blobstore template_env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.getcwd())) class MainPageHandler(webapp2.RequestHandler): def get(self): upload_url = blobstore.create_upload_url('/blob/') template = template_env.get_template('blob.html') context = { 'upload_url': upload_url } self.response.write(template.render(context)) class MainPageHandler(webapp2.RequestHandler): def get(self): #Here goes anything you want on / class MainPageHandler(webapp2.RequestHandler): def get(self): #Here goes anything you want on / class UploadFormHandler(webapp2.RequestHandler): def post(self): blobs = self.get_uploads('upload') # So some logging here and concept to store the reference of the blob key. #self.redirect('/') app = webapp2.WSGIApplication([ # Essential handlers ("/", MainPageHandler), ("/upload/", UploadFormHandler), ('/upload/picture/', PictureUploadHandler), ],debug=True, config=config.config) # Extra Hanlder like 404 500 etc def handle_404(request, response, exception): logging.exception(exception) response.write('Oops! Naughty Mr. Jiggles (This is a 404)') response.set_status(404) app.error_handlers[404] = handle_404