I have tried to move to Python 2.7 from Python 2.5 but I keep getting the same error everytime.
I have made a very simple test in Python 2.5 working with the app.yaml file and just one script main.py and it works fine. The script it just a Hello World type to check everythin works fine.
app.yaml
application: sparepartsfinder version: 1 runtime: python api_version: 1 handlers: - url: /blog script: main.py - url: /blog/new_entry script: main.py
main.py
from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class MainPage(webapp.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, webapp World!') application = webapp.WSGIApplication( [('/', MainPage), ('/blog', MainPage), ('/blog/new_entry',MainPage), ('/blog/archive/.*',MainPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main()
When I change to Python 2.7 I follow the documents on the Google App Engine to the letter making the changes in both the app.yaml and main.py script.
app.yaml
application: sparepartsfinder version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /blog script: main.py - url: /blog/new_entry script: main.py - url: /blog/archive/.* script: main.py - url: .* script: main.py
main.py
import webapp2 class MainPage(webapp2.RequestHandler): def get(self): self.response.out.write('Hello prueba!') app = webapp2.WSGIApplication([('/', MainPage), ('/blog', MainPage), ('/blog/new_entry',MainPage), ('/blog/archive/.*',MainPage)], debug=True)
Unfortunately it doesn't work either in local or when I try to upload the new configuration to the Google App Engine. ( I get always the same mistake).
I may understand the problem in my machine ( I have both Python 2.5 and 2.7 ) on a Windows XP, but not when I upload.
This is the error:
2012-05-04 13:02:07 Running command: "[u'C:\Python25\python2.5.exe', '-u', 'C:\Archivos >de programa\Google\google_appengine\appcfg.py', '--no_cookies', u'[email protected]', '--passin', 'update', 'C:\Documents and Settings\SSanjuan\Mis documentos\Dropbox\Dropbox\Python\SpareParts']" Error parsing yaml file: Invalid object: threadsafe cannot be enabled with CGI handler: main.py in "C:\Documents and Settings\SSanjuan\Mis documentos\Dropbox\Dropbox\Python\SpareParts\app.yaml", line 27, column 1 2012-05-04 13:02:31 (Process exited with code 1)
Use main.application
instead of main.py
in your app.yaml. You need the former in order to set threadsafe
to true
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With