Pyramid on GAE

303 views
Skip to first unread message

Jim Washington

unread,
Mar 5, 2012, 7:09:04 AM3/5/12
to pylons-...@googlegroups.com
Python2.7 on Google App Engine has moved out of "experimental".

http://googleappengine.blogspot.com/2012/02/announcing-general-availability-of.html

According to a comment on
http://www.reddit.com/r/AppEngine/comments/q8p60/announcing_the_general_availability_of_the_python/

2.7 performance issues seem to be fixed.

Has anyone given it a shakedown with Pyramid yet?

- Jim Washington

Thomas G. Willis

unread,
Mar 5, 2012, 10:57:40 AM3/5/12
to pylons-...@googlegroups.com
Yeah. It works, performance is nearly on par with the 2.5 runtime according to our load tests. 

There are quirks but nothing pyramid specific. 

Fábio Dias

unread,
Mar 14, 2012, 1:01:31 PM3/14/12
to pylons-...@googlegroups.com
Hi! I'm actually trying to do a simple web app using Python 2.7 and pyramid (v 1.3) however I'm stuck in the process of running a demo locally because the documentation from the Pyramid website stops after the installation of the Pyramid framework in the virtual environment, using this tutorial here:  http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/install.html#installing-pyramid-on-google-app-engine 

So I'm new to this world and I'm kind of lost. I've already read and followed Pyramid tutorials and the same for the App Engine but still no success on running  locally the web app with Pyramid framework.  

I would appreciate some lights on doing this! My development environment is Windows 7 with Python 2.7 (and setuptool) installed.

Many thanks and sorry about my English. It's the first time that I've been searching for help somewhere out of books or documentation.

Best regards,
Fábio Dias.

Thomas G. Willis

unread,
Mar 14, 2012, 2:04:27 PM3/14/12
to pylons-...@googlegroups.com
Hello, one of the tasks that was outlined as part of the sprints after pycon was improving the documentation for running pyramid on appengine. 

I've thrown some code out here with some docs in the readme

if you want to give that a spin, just file an issue in github if you have any issues. 


Thomas G. Willis


--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pylons-discuss/-/llk2mnSoRAQJ.

To post to this group, send email to pylons-...@googlegroups.com.
To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.

Jim Washington

unread,
Mar 21, 2012, 4:59:00 PM3/21/12
to pylons-...@googlegroups.com
On Wed, 2012-03-14 at 14:04 -0400, Thomas G. Willis wrote:
> Hello, one of the tasks that was outlined as part of the sprints after
> pycon was improving the documentation for running pyramid on
> appengine.
>
>
> I've thrown some code out here with some docs in the readme
> https://github.com/twillis/pyramid_appengine
>
>
>
>
> if you want to give that a spin, just file an issue in github if you
> have any issues.

It's working for me. My notes:

Pyramid-1.3 works just fine with webob-1.1.1. Pyramid tests all work,
and the buildout takes care of putting the gae-supported webob in the
development appserver, so you should get a heads-up through testing if
there are any edge cases in your app. You will end up with an extra
webob egg in the eggs folder, but that doesn't matter because the stuff
in parts/MyApp is what goes to appengine.

Anytime you add a required dependency in your app's setup.py, also add
that dependency (and sub-dependencies, if any) to the
rod.recipe.appengine stanza in buildout.cfg. Then re-run bin/buildout.
Note that apps can be spelled differently in the two places. E.g., it's
"pyramid_rpc" in requires, and "pyramid-rpc" in the appengine stanza.

You want pyramid installed in your system python. Don't bother with a
virtualenv when using this buildout; the paths get duplicative and
confusing. Installing pyramid in your system python makes

> pcreate -t appengine_starter MyApp

or

> paster create -t appengine_starter MyApp

available to you when you want it.

You do not want zc.buildout installed system-wide. If you get "can't
find it" errors, that is the most likely problem. When you do "python
bootstrap.py", don't forget the --distribute. e.g.,

python bootstrap.py --distribute

To run the devappserver, point it to parts/MyApp, not src/MyApp.

> bin/devappserver parts/MyApp

Point "bin/appcfg update" to the same location.

Make sure you run bin/buildout before running, testing or updating your
app! parts/MyApp is updated from src/MyApp by buildout.

Tasty stuff, BTW.

Proof of the pudding at http://test-app-509.appspot.com/

- Jim Washington


Thomas G. Willis

unread,
Mar 22, 2012, 6:22:11 AM3/22/12
to pylons-...@googlegroups.com
Hey Jim, 

Thanks for the feedback. I was pleasantly surprised you got it working on pyramid 1.3. I'll have to cut another release to pypi I suppose. :)

Depending on when you pulled you may have noticed that unit tests are run through py.test and it takes care of bootstrapping the appengine services for your tests and keeps the index.yaml updated for you(see conftest.py). I am pretty happy with how that turned out because when I was doing my first appengine app, the challenge was writing/running tests under the devappserver environment.  

Thanks again.

now to finish the cookbook recipe. 

Thomas G. Willis

unread,
Mar 22, 2012, 7:05:19 AM3/22/12
to pylons-...@googlegroups.com
Hi Jim, I just tried it with pyramid 1.3 and I didn't get the same results you did.


Got pyramid 1.3.
While:
  Installing myae.
Error: There is a version conflict.
We already have: WebOb 1.1.1
but pyramid 1.3 requires 'WebOb>=1.2dev'.



Is there something you did differently than just running ./bin/buildout ?

Jim Washington

unread,
Mar 22, 2012, 7:24:52 AM3/22/12
to pylons-...@googlegroups.com, Thomas G. Willis
On Thu, 2012-03-22 at 04:05 -0700, Thomas G. Willis wrote:
> Hi Jim, I just tried it with pyramid 1.3 and I didn't get the same
> results you did.
>
My git diff is attached.

Caution: it's at "works for me"

- Jim

pae_diff.patch

Thomas G. Willis

unread,
Mar 22, 2012, 7:37:27 AM3/22/12
to pylons-...@googlegroups.com, Thomas G. Willis
Thanks Jim, I'll give it a whirl. 

If you have any other suggestions/issues just file them here. https://github.com/twillis/pyramid_appengine

Thanks again for the feedback. 

Jim Washington

unread,
Mar 25, 2012, 8:29:55 AM3/25/12
to pylons-...@googlegroups.com, Thomas G. Willis
Hi, all

I have forked

https://github.com/twillis/pyramid_appengine
>
>
and added some pyjamas-friendly stuff to it.

It's at

https://github.com/jwashin/pj_pyramid_appengine


FYI, Pyjamas http://pyjs.org is a python-language front-end application
package. It allows you to think of your web app as a python desktop
application, rather than as a bunch of web pages. It currently can do
desktop applications (with a forked webkit-gtk or MSHTML) and web
applications (python translated to javascript) using the same code. It
makes fat clients, like GWT, which pyjamas began as a python version of.
Pyjamas works very nicely with a pyramid backend through pyramid_rpc's
JSON-RPC implementation.

So, if you want to experiment with Pyramid+Pyjamas+GAE, it's never been
easier.

It includes sample code, so you quickly will get something
that looks like http://test-app-509.appspot.com/ on your local port
8080, ready for upload/update to GoogleAppEngine.

Read the directions. git clone it. "python setup.py" it. Try it out.

Feedback welcome.

- Jim Washington


Ginés Martínez

unread,
Mar 25, 2012, 12:12:54 PM3/25/12
to pylons-...@googlegroups.com
Fine!


- Jim Washington


--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.

bismigalis

unread,
Sep 3, 2012, 10:27:07 AM9/3/12
to pylons-...@googlegroups.com
I am trying to run Pyramid 1.3 app on app engine python27 after cookbook recipe Pyramid on Google’s App Engine (using buildout). All work fine when I return Response object directly, but when i am using renderer option with chameleon template or render_to_responce, I get error 

Traceback (most recent call last):
  File "/home/user/workspace/qlugat/parts/google_appengine/google/appengine/runtime/wsgi.py", line 195, in Handle
    result = handler(dict(self._environ), self._StartResponse)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/router.py", line 187, in __call__
    response = self.handle_request(request)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/tweens.py", line 20, in excview_tween
    response = handler(request)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/router.py", line 164, in handle_request
    response = view_callable(context, request)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/config/views.py", line 352, in rendered_view
    context)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/renderers.py", line 396, in render_view
    return self.render_to_response(response, system, request=request)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/renderers.py", line 426, in render_to_response
    result = self.render(value, system_values, request=request)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/renderers.py", line 399, in render
    renderer = self.renderer
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/decorator.py", line 17, in __get__
    val = self.wrapped(inst)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/renderers.py", line 383, in renderer
    return factory(self)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/chameleon_zpt.py", line 25, in renderer_factory
    return renderers.template_renderer_factory(info, ZPTTemplateRenderer)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/renderers.py", line 351, in template_renderer_factory
    return lookup(info)
  File "/home/user/workspace/qlugat/parts/qlugat/pyramid/renderers.py", line 323, in __call__
    if not pkg_resources.resource_exists(package_name, filename):
  File "/home/user/workspace/qlugat/parts/qlugat/pkg_resources.py", line 897, in resource_exists
    return get_provider(package_or_requirement).has_resource(resource_name)
  File "/home/user/workspace/qlugat/parts/qlugat/pkg_resources.py", line 1196, in has_resource
    return self._has(self._fn(self.module_path, resource_name))
  File "/home/user/workspace/qlugat/parts/qlugat/pkg_resources.py", line 1250, in _has
    "Can't perform this operation for unregistered loader type"
NotImplementedError: Can't perform this operation for unregistered loader type

Thomas G. Willis

unread,
Sep 3, 2012, 12:50:36 PM9/3/12
to pylons-...@googlegroups.com
looks like it's bombing out on some setup tools magic(probably some entry points stuff), which doesn't work on appengine. I don't know enough about Chameleon to know what the fix would be. 

Also, unless you changed buildout.cfg to include it, chameleon won't be deployed with your app anyway. 
Reply all
Reply to author
Forward
0 new messages