Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. gcloud app deploy
  2.  
  3. https://myapp.appspot.com/foo.txt
  4.  
  5. C:myapp>"C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkplatformgoogle_appengineremote_api_shell.py" myapp
  6. App Engine remote_api shell
  7. Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]
  8. The db, ndb, users, urlfetch, and memcache modules are imported.
  9. s~myapp> from main import Foo
  10. WARNING:root:You are using the default Django version (0.96). The default Django version will change in an App Engine release in the near future. Please call use_library() to explicitly select a Django version. For more information see https://developers.google.com/appengine/docs/python/tools/libraries#Django
  11. Traceback (most recent call last):
  12. File "<console>", line 1, in <module>
  13. File "main.py", line 3, in <module>
  14. from google.appengine.ext.webapp import template
  15. File "C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkplatformgoogle_appenginegoogleappengineextwebapptemplate.py", line 63, in <module>
  16. webapp._config_handle.django_setup()
  17. File "C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkplatformgoogle_appenginegoogleappengineextwebapp__init__.py", line 176, in _django_setup
  18. import django
  19. ImportError: No module named django
  20. s~myapp>
  21.  
  22. runtime: python27
  23. api_version: 1
  24. threadsafe: false
  25. builtins:
  26. - remote_api: on
  27. handlers:
  28. - url: /.*
  29. script: main.py
  30.  
  31. Host: '{{ host }}'
  32.  
  33. import os
  34. import google.appengine.ext.db
  35. from google.appengine.ext.webapp import template
  36. from google.appengine.ext import webapp
  37. from google.appengine.ext.webapp.util import run_wsgi_app
  38. from google.appengine.ext import db
  39.  
  40. class Foo(db.Model):
  41. bar = db.IntegerProperty()
  42.  
  43. class FooTxt(webapp.RequestHandler):
  44. def get(self):
  45. template_values = {
  46. 'host': self.request.host
  47. }
  48.  
  49. path = os.path.join(os.path.dirname(__file__), 'foo.txt')
  50. self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
  51. self.response.out.write(template.render(path, template_values))
  52.  
  53. application = webapp.WSGIApplication([('/foo.txt', FooTxt)], debug = False)
  54.  
  55. def main():
  56. run_wsgi_app(application)
  57.  
  58. if __name__ == "__main__":
  59. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement