librelist archives

« back to archive

Flask extensions on App Engine

Flask extensions on App Engine

From:
Joshua Bronson
Date:
2011-03-18 @ 16:58
Dear Flask development list,

I'm running Flask on Google App Engine and have just tried to use Flask
extensions for the first time. Trying to import an installed extension is
resulting in ImportError.

To lay out my project, I'm using the virtualenv-with-symlinks approach
suggested in

http://stackoverflow.com/questions/4863557/how-do-i-manage-third-party-python-libraries-with-google-app-engine-virtualenv/4863970#4863970,
which has been working fine up until now.

Is there any way to get flask extensions to work on App Engine?

Thanks,
Josh

Re: [flask] Flask extensions on App Engine

From:
Kamal Gill
Date:
2011-03-18 @ 17:13
Hi Josh,

See the flask-appengine-template project for an example of how to get 
Flask extensions to work on App Engine.
https://github.com/kamalgill/flask-appengine-template

Drop the extension into the namespace package folder at 
src/packages/flaskext and you're all set.

https://github.com/kamalgill/flask-appengine-template/tree/master/src/packages/flaskext

HTH,
Kamal

On Mar 18, 2011, at 9:58 AM, Joshua Bronson wrote:

> Dear Flask development list,
> 
> I'm running Flask on Google App Engine and have just tried to use Flask 
extensions for the first time. Trying to import an installed extension is 
resulting in ImportError.
> 
> To lay out my project, I'm using the virtualenv-with-symlinks approach 
suggested in 
http://stackoverflow.com/questions/4863557/how-do-i-manage-third-party-python-libraries-with-google-app-engine-virtualenv/4863970#4863970,
which has been working fine up until now.
> 
> Is there any way to get flask extensions to work on App Engine?
> 
> Thanks,
> Josh
> 

Re: [flask] Flask extensions on App Engine

From:
Joshua Bronson
Date:
2011-03-18 @ 17:23
On Fri, Mar 18, 2011 at 1:13 PM, Kamal Gill <designbykamal@gmail.com> wrote:

> Hi Josh,
>
> See the flask-appengine-template project for an example of how to get Flask
> extensions to work on App Engine.
> https://github.com/kamalgill/flask-appengine-template
>
> Drop the extension into the namespace package folder at
> src/packages/flaskext and you're all set.
>
> 
https://github.com/kamalgill/flask-appengine-template/tree/master/src/packages/flaskext
>
> HTH,
> Kamal


Thanks, Kamal, flask-appengine-template looks like just the thing I was
looking for-- wish I had found it sooner! I have to run out for a bit but am
excited to try this when I get back. Will report back with my results.

Thanks again,
Josh

Re: [flask] Flask extensions on App Engine

From:
Joshua Bronson
Date:
2011-03-21 @ 22:53
Hey Kamal,

On Fri, Mar 18, 2011 at 1:23 PM, Joshua Bronson <jabronson@gmail.com> wrote:

> On Fri, Mar 18, 2011 at 1:13 PM, Kamal Gill <designbykamal@gmail.com>wrote:
>
>> Hi Josh,
>>
>> See the flask-appengine-template project for an example of how to get
>> Flask extensions to work on App Engine.
>> https://github.com/kamalgill/flask-appengine-template
>>
>> Drop the extension into the namespace package folder at
>> src/packages/flaskext and you're all set.
>>
>> 
https://github.com/kamalgill/flask-appengine-template/tree/master/src/packages/flaskext
>>
>> HTH,
>> Kamal
>
>
> Thanks, Kamal, flask-appengine-template looks like just the thing I was
> looking for-- wish I had found it sooner! I have to run out for a bit but am
> excited to try this when I get back. Will report back with my results.
>
> Thanks again,
> Josh
>

I've changed my source layout to use a combination of my original approach
and yours, and I'm pretty satisfied for now. I'm using git submodule to
include some of my dependencies (e.g. flask, jinja2, werkzeug) which I'm
symlinking into the packages directory, and symlinking individual modules
into the flaskext namespace package. Never would have been possible before
Google raised the max number of files and blobs limit. My code is at
https://github.com/jab/bravenewsoftware.org in case anyone wants to take a
peek.

Thanks for pointing me toward your helpful project!

-Josh

Re: [flask] Flask extensions on App Engine

From:
Paul Burt
Date:
2011-03-18 @ 17:13
Empty the __init __.py file in flaskext and it will work.
On Mar 18, 2011 4:59 PM, "Joshua Bronson" <jabronson@gmail.com> wrote:
> Dear Flask development list,
>
> I'm running Flask on Google App Engine and have just tried to use Flask
> extensions for the first time. Trying to import an installed extension is
> resulting in ImportError.
>
> To lay out my project, I'm using the virtualenv-with-symlinks approach
> suggested in
>

http://stackoverflow.com/questions/4863557/how-do-i-manage-third-party-python-libraries-with-google-app-engine-virtualenv/4863970#4863970
,
> which has been working fine up until now.
>
> Is there any way to get flask extensions to work on App Engine?
>
> Thanks,
> Josh

Re: [flask] Flask extensions on App Engine

From:
Joshua Bronson
Date:
2011-03-18 @ 17:22
On Fri, Mar 18, 2011 at 1:13 PM, Paul Burt <paul.burt@gmail.com> wrote:

> Empty the __init __.py file in flaskext and it will work.
>
Nope, pkg_resources.py isn't the problem, I'm including it alongside my
code. But thanks anyway.

Re: Flask extensions on App Engine

From:
Joshua Bronson
Date:
2011-03-18 @ 17:13
On Fri, Mar 18, 2011 at 12:58 PM, Joshua Bronson <jabronson@gmail.com>wrote:

> Trying to import an installed extension is resulting in ImportError.
>

Meant to say: It's all working fine with Flask's built-in server; the
problem only occurs when I use App Engine's dev_appserver.py.

Re: [flask] Re: Flask extensions on App Engine

From:
Eric Seidel
Date:
2011-03-18 @ 17:15
> On Fri, Mar 18, 2011 at 12:58 PM, Joshua Bronson <jabronson@gmail.com> wrote:
> Trying to import an installed extension is resulting in ImportError.
> 
> Meant to say: It's all working fine with Flask's built-in server; the 
problem only occurs when I use App Engine's dev_appserver.py.

Can you get it to work on App Engine itself? I have a similar problem with
dev_appserver.py on OS X, but luckily using Google's GUI app solves it :)

Eric

Re: [flask] Re: Flask extensions on App Engine

From:
Joshua Bronson
Date:
2011-03-18 @ 17:28
On Fri, Mar 18, 2011 at 1:15 PM, Eric Seidel <gridaphobe@gmail.com> wrote:

> Can you get it to work on App Engine itself?
>

Different issue. Before I added the extensions, it was working for me both
from the command line and the GUI, and now both give the ImportError for
flaskext.<foo>.

I have a similar problem with dev_appserver.py on OS X, but luckily using
> Google's GUI app solves it :)
>

If your ImportError is being thrown when werkzeug tries to import inspect,
then it's a different problem, but one I also hit and was able to work
around by using
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 to
execute dev_appserver.py rather than macports python2.5.

HTH,
Josh

Re: [flask] Re: Flask extensions on App Engine

From:
Kates Gasis
Date:
2011-03-18 @ 22:57
appengine isn't really very friendly with virtualenv for now. i got my
extensions to work by putting them in my flask app directory.

On Mar 19, 2011, at 1:29 AM, Joshua Bronson <jabronson@gmail.com> wrote:

On Fri, Mar 18, 2011 at 1:15 PM, Eric Seidel <gridaphobe@gmail.com> wrote:

> Can you get it to work on App Engine itself?
>

Different issue. Before I added the extensions, it was working for me both
from the command line and the GUI, and now both give the ImportError for
flaskext.<foo>.

I have a similar problem with dev_appserver.py on OS X, but luckily using
> Google's GUI app solves it :)
>

If your ImportError is being thrown when werkzeug tries to import inspect,
then it's a different problem, but one I also hit and was able to work
around by using
/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 to
execute dev_appserver.py rather than macports python2.5.

HTH,
Josh