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
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 >
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
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
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
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.
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.
> 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
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
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