Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gcloud app deploy
- https://myapp.appspot.com/foo.txt
- C:myapp>"C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkplatformgoogle_appengineremote_api_shell.py" myapp
- App Engine remote_api shell
- Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]
- The db, ndb, users, urlfetch, and memcache modules are imported.
- s~myapp> from main import Foo
- 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
- Traceback (most recent call last):
- File "<console>", line 1, in <module>
- File "main.py", line 3, in <module>
- from google.appengine.ext.webapp import template
- File "C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkplatformgoogle_appenginegoogleappengineextwebapptemplate.py", line 63, in <module>
- webapp._config_handle.django_setup()
- File "C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkplatformgoogle_appenginegoogleappengineextwebapp__init__.py", line 176, in _django_setup
- import django
- ImportError: No module named django
- s~myapp>
- runtime: python27
- api_version: 1
- threadsafe: false
- builtins:
- - remote_api: on
- handlers:
- - url: /.*
- script: main.py
- Host: '{{ host }}'
- import os
- import google.appengine.ext.db
- from google.appengine.ext.webapp import template
- from google.appengine.ext import webapp
- from google.appengine.ext.webapp.util import run_wsgi_app
- from google.appengine.ext import db
- class Foo(db.Model):
- bar = db.IntegerProperty()
- class FooTxt(webapp.RequestHandler):
- def get(self):
- template_values = {
- 'host': self.request.host
- }
- path = os.path.join(os.path.dirname(__file__), 'foo.txt')
- self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
- self.response.out.write(template.render(path, template_values))
- application = webapp.WSGIApplication([('/foo.txt', FooTxt)], debug = False)
- def main():
- run_wsgi_app(application)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement