kamalgill / flask-appengine-template Goto Github PK
View Code? Open in Web Editor NEWBoilerplate project template for running Flask on Google App Engine -- supplanted by https://github.com/kamalgill/cloud-starterkit-flask-appengine
Boilerplate project template for running Flask on Google App Engine -- supplanted by https://github.com/kamalgill/cloud-starterkit-flask-appengine
Add a URL dispatch configuration file (urls.py) to decouple the URL route configuration from the view file, using the Flask app object's add_url_rule() method, allowing the application to gracefully handle larger application structures.
The Flask docs specify how to leverage Jinja2 template macros to streamline form field generation. The example forms in this app should demonstrate how to use the render_field method to provide a field-generation option for developers.
In "app.yaml":
handlers:
should be:
handlers:
See "packages" in "static_dir"
From code here: https://bitbucket.org/simplecodes/wtforms/pull-request/16/added-ndbpy-for-compat-with-ndb-project/diff
I would create a pull request, but I'm not sure how to properly attribute the code and licenses.
Many of the files in the Werkzeug package are set to 755. Batch process them with the following to remove the exec bits.
find . -type f -print | xargs chmod 644
The zip package archives (in the src/packages folder) should be created without compression (via zip -r0 ...) for quicker warmup and serving performance.
Would be awesome for new users to have https://github.com/thadeusb/flask-cache as a default extension.
Replace deprecated csrf_token attribute with hidden_tag method in form-based templates.
The deprecation warning is issued in Flask-WTF 0.3.
Re-enable support for Flask Debug Toolbar.
I suggest putting
DEBUG_MODE = True
in the /application/settings.py
because this flask-appengine-template is a starting point for a new project, and the debug mode is usually put in "True".
Obviously that should be reflected in the README file as an hint there too.
Thanks,
error issued:
time=config.LOCK_TIMEOUT, namespace=config.KEY_NAMESPACE):
File "D:\google_appengine\google\appengine\api\memcache__init__.py", line 784
, in add
namespace=namespace)
File "D:\google_appengine\google\appengine\api\memcache__init__.py", line 869
, in _set_with_policy
status_dict = rpc.get_result()
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 612
, in get_result
return self.get_result_hook(self)
File "D:\google_appengine\google\appengine\api\memcache__init.py", line 974
, in set_with_policy_hook
rpc.check_success()
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 578
, in check_success
self.__rpc.CheckSuccess()
File "D:\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in
_WaitImpl
self.request, self.response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 226, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File "D:\google_appengine\google\appengine\tools\appengine_rpc.py", line 409,
in Send
f = self.opener.open(req)
File "D:\Python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
File "D:\Python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Python27\lib\urllib2.py", line 444, in error
return self._call_chain(_args)
File "D:\Python27\lib\urllib2.py", line 378, in _call_chain
result = func(_args)
File "D:\Python27\lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 301: Moved Permanently
HTTPError()
HTTPError()
Traceback (most recent call last):
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 1302, in communicate
req.respond()
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 831, in respond
self.server.gateway(self).respond()
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "D:\google_appengine\google\appengine\tools\devappserver2\wsgi_server.py"
, line 269, in __call
return app(environ, start_response)
File "D:\google_appengine\google\appengine\tools\devappserver2\request_rewrite
r.py", line 311, in rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "D:\google_appengine\google\appengine\tools\devappserver2\python\request
handler.py", line 148, in call
self.flush_logs(response.get('logs', []))
File "D:\google_appengine\google\appengine\tools\devappserver2\python\request
handler.py", line 284, in _flush_logs
apiproxy_stub_map.MakeSyncCall('logservice', 'Flush', request, response)
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 94,
in MakeSyncCall
return stubmap.MakeSyncCall(service, call, request, response)
INFO 2014-01-17 15:24:30,605 module.py:617] default: "GET /_ah/warmup HTTP/1
.1" 500 -
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 328
, in MakeSyncCall
rpc.CheckSuccess()
File "D:\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in
_WaitImpl
self.request, self.response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 226, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File "D:\google_appengine\google\appengine\tools\appengine_rpc.py", line 409,
in Send
f = self.opener.open(req)
File "D:\Python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
File "D:\Python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Python27\lib\urllib2.py", line 444, in error
return self._call_chain(_args)
File "D:\Python27\lib\urllib2.py", line 378, in _call_chain
result = func(_args)
File "D:\Python27\lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 301: Moved Permanently
Traceback (most recent call last):
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 1302, in communicate
req.respond()
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 831, in respond
self.server.gateway(self).respond()
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "D:\google_appengine\google\appengine\tools\devappserver2\wsgi_server.py"
, line 269, in call
return app(environ, start_response)
File "D:\google_appengine\google\appengine\tools\devappserver2\request_rewrite
r.py", line 311, in rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "D:\google_appengine\google\appengine\tools\devappserver2\python\request
handler.py", line 148, in call
self.flush_logs(response.get('logs', []))
File "D:\google_appengine\google\appengine\tools\devappserver2\python\request
handler.py", line 284, in _flush_logs
apiproxy_stub_map.MakeSyncCall('logservice', 'Flush', request, response)
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 94,
in MakeSyncCall
return stubmap.MakeSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 328
, in MakeSyncCall
rpc.CheckSuccess()
File "D:\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in
_WaitImpl
self.request, self.response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 226, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File "D:\google_appengine\google\appengine\tools\appengine_rpc.py", line 409,
in Send
f = self.opener.open(req)
File "D:\Python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
File "D:\Python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Python27\lib\urllib2.py", line 444, in error
return self.call_chain(args)
File "D:\Python27\lib\urllib2.py", line 378, in call_chain
result = func(args)
File "D:\Python27\lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 301: Moved Permanently
ERROR 2014-01-17 07:24:32,967 wsgi.py:278]
Traceback (most recent call last):
File "D:\google_appengine\google\appengine\runtime\wsgi.py", line 267, in Hand
le
for chunk in result:
File "D:\google_appengine\google\appengine\ext\appstats\recording.py", line 12
50, in appstats_wsgi_wrapper
start_recording(environ)
File "D:\google_appengine\google\appengine\ext\appstats\recording.py", line 13
87, in start_recording
time=config.LOCK_TIMEOUT, namespace=config.KEY_NAMESPACE):
File "D:\google_appengine\google\appengine\api\memcache__init.py", line 784
, in add
namespace=namespace)
File "D:\google_appengine\google\appengine\api\memcache__init.py", line 869
, in _set_with_policy
status_dict = rpc.get_result()
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 612
, in get_result
return self.get_result_hook(self)
File "D:\google_appengine\google\appengine\api\memcache__init.py", line 974
, in set_with_policy_hook
rpc.check_success()
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 578
, in check_success
self.__rpc.CheckSuccess()
File "D:\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in
_WaitImpl
self.request, self.response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 226, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File "D:\google_appengine\google\appengine\tools\appengine_rpc.py", line 409,
in Send
f = self.opener.open(req)
File "D:\Python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
File "D:\Python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Python27\lib\urllib2.py", line 444, in error
return self._call_chain(_args)
File "D:\Python27\lib\urllib2.py", line 378, in _call_chain
result = func(_args)
File "D:\Python27\lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 301: Moved Permanently
HTTPError()
HTTPError()
Traceback (most recent call last):
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 1302, in communicate
req.respond()
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 831, in respond
self.server.gateway(self).respond()
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "D:\google_appengine\google\appengine\tools\devappserver2\wsgi_server.py"
, line 269, in __call
return app(environ, start_response)
File "D:\google_appengine\google\appengine\tools\devappserver2\request_rewrite
r.py", line 311, in rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "D:\google_appengine\google\appengine\tools\devappserver2\python\request
handler.py", line 148, in call
self.flush_logs(response.get('logs', []))
File "D:\google_appengine\google\appengine\tools\devappserver2\python\request
handler.py", line 284, in _flush_logs
apiproxy_stub_map.MakeSyncCall('logservice', 'Flush', request, response)
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 94,
in MakeSyncCall
return stubmap.MakeSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 328
, in MakeSyncCall
rpc.CheckSuccess()
File "D:\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in
_WaitImpl
self.request, self.response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 226, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File "D:\google_appengine\google\appengine\tools\appengine_rpc.py", line 409,
in Send
f = self.opener.open(req)
File "D:\Python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
File "D:\Python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Python27\lib\urllib2.py", line 444, in error
return self._call_chain(_args)
File "D:\Python27\lib\urllib2.py", line 378, in _call_chain
result = func(_args)
File "D:\Python27\lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 301: Moved Permanently
Traceback (most recent call last):
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 1302, in communicate
req.respond()
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 831, in respond
self.server.gateway(self).respond()
File "D:\google_appengine\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", li
ne 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "D:\google_appengine\google\appengine\tools\devappserver2\wsgi_server.py"
, line 269, in call
return app(environ, start_response)
File "D:\google_appengine\google\appengine\tools\devappserver2\request_rewrite
r.py", line 311, in rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "D:\google_appengine\google\appengine\tools\devappserver2\python\request
handler.py", line 148, in call
self.flush_logs(response.get('logs', []))
File "D:\google_appengine\google\appengine\tools\devappserver2\python\request
handler.py", line 284, in _flush_logs
apiproxy_stub_map.MakeSyncCall('logservice', 'Flush', request, response)
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 94,
in MakeSyncCall
return stubmap.MakeSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 328
, in MakeSyncCall
rpc.CheckSuccess()
INFO 2014-01-17 15:24:33,601 module.py:617] default: "GET / HTTP/1.1" 500 -
File "D:\google_appengine\google\appengine\api\apiproxy_rpc.py", line 156, in
_WaitImpl
self.request, self.response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "D:\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py",
line 226, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File "D:\google_appengine\google\appengine\tools\appengine_rpc.py", line 409,
in Send
f = self.opener.open(req)
File "D:\Python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
File "D:\Python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "D:\Python27\lib\urllib2.py", line 444, in error
return self._call_chain(_args)
File "D:\Python27\lib\urllib2.py", line 378, in _call_chain
result = func(_args)
File "D:\Python27\lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 301: Moved Permanently
seems, google already wrap up for their blobstore of images.
it is really good to have some examples for how i can upload images in flask, since they are different from flask and web2app?
Guys, not sure if anyone came across that:
If I run this in the terminal (Mac)
export FLASK_CONF=DEV
and then start the app through dev_appserver.py src/
but logging.info() shows it has not loaded the development environment.
Same is in Eclipse:
Even though Eclipse.s environment is set to FLASK_CONF=DEV the break point never goes into if os.getenv('FLASK_CONF') == 'DEV':
. When I run the tests though, I see elif os.getenv('FLASK_CONF') == 'TEST':
is hitting.
if os.getenv('FLASK_CONF') == 'DEV':
#development settings not to be used in production
app.config.from_object('application.settings.Development')
# Flask-DebugToolbar (only enabled when DEBUG=True)
toolbar = DebugToolbarExtension(app)
# Werkzeug Debugger - enabled by default in new versions of Flask
#if you set debug to true, right?
# app.wsgi_app = DebuggedApplication(app.wsgi_app, evalex=True)
elif os.getenv('FLASK_CONF') == 'TEST':
app.config.from_object('application.settings.Testing')
Why is this not working anymore. Anyone came across that yet?
Many Thanks for your help,
Hooman
The new location is http://localhost:8000
Hi,
I love this project, it helped us a lot getting flask deployed on gae.
The simple examples were simply awesome to understand the underlying ndb as well. Very useful indeed.
I have a suggestion for this project:
One thing that is missing though, is paging in ndb and how to handle that in flask.
There is this excellent paging demo in flask, which however uses SQLAlchemy:
https://github.com/mitsuhiko/flask-feedback
demo to be seen online:
http://feedback.flask.pocoo.org/
I was trying to adjust that to use ndb instead of alchemy, and can't get it fully right.
def show_feedback(kind, page):
"""Renders returned feedback."""
curs = Cursor(urlsafe=request.args.get('cursor'))
feedback_for_page, next_cursor, more = Feedback.query().filter(Feedback.kind==Feedback.KINDS[kind]).order(-Feedback.pub_date, Feedback.key).fetch_page(page, start_cursor=curs)
return render_template('show_feedback.html', kind=kind, feedback_for_page=feedback_for_page, next_cursor=next_cursor, more=more)
It would be so awesome providing an example snippet in this project how to use gae-paging within flask.
Regards,
Hooman
Right out of the box I have attempted to add an ndb.KeyProperty to models.py, and end up with an error saying that KeyProperty has no attribute _reference_class
. I've traced this down to line 329 in /src/lib/wtforms/ext/appengine/ndb.py
:
kwargs['reference_class'] = prop._reference_class
It appears to be looking for 'reference_class' which is an old db.model
idiom. The analog for ndb is kind
, but swapping out line 329 with an instruction to look for the kind
attribute just results in a deeper set of issues.
kwargs['reference_class'] = prop._kind
Add the Flask-DebugToolbar (http://flask-debugtoolbar.readthedocs.org)
I generally don't put the libs into my git repository and use make setup
to download them instead.
I was wondering if I could delete lib/gae_mini_profiler and install it via pip?
pip install gae_mini_profiler
But I can't find any way to achieve this. Please advice if you know a way.
Many Thanks,
Houman
Trying to run Kamal Gill's flask-appengine-template on the GAE dev server on Windows. Get this error when trying to GET a page. Already tried re-installing both Python and App Engine. After deployment, works well.
Log:
ERROR 2013-03-19 12:49:58,648 wsgi.py:219]
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 255, in _LoadHandler
handler = import(path[0])
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1766, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1630, in FindAndLoadModule
description)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, args, *kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1577, in LoadModuleRestricted
description)
File "F:\src\application__init.py", line 23, in
import urls
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1766, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1630, in FindAndLoadModule
description)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1577, in LoadModuleRestricted
description)
File "F:\src\application\urls.py", line 10, in
from application import views
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1766, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1630, in FindAndLoadModule
description)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1577, in LoadModuleRestricted
description)
File "F:\src\application\views.py", line 20, in
from forms import ExampleForm
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1766, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1630, in FindAndLoadModule
description)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1577, in LoadModuleRestricted
description)
File "F:\src\application\forms.py", line 11, in
from flaskext import wtf
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1766, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1630, in FindAndLoadModule
description)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, args, *kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1577, in LoadModuleRestricted
description)
File "F:\src\flaskext__init.py", line 1, in
import('pkg_resources').declare_namespace(name)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1766, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1630, in FindAndLoadModule
description)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 692, in Decorate
return func(self, _args, *_kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1577, in LoadModuleRestricted
description)
File "F:\src\pkg_resources.py", line 2646, in
working_set = WorkingSet()
File "F:\src\pkg_resources.py", line 397, in init
self.add_entry(entry)
File "F:\src\pkg_resources.py", line 412, in add_entry
for dist in find_distributions(entry, True):
File "F:\src\pkg_resources.py", line 1694, in find_on_path
for entry in os.listdir(path_item):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 636, in call
raise OSError(errno.EACCES, 'path not accessible', path)
OSError: [Errno 13] path not accessible: 'c:\python27\dlls'
INFO 2013-03-19 12:49:58,757 dev_appserver.py:3104] "GET / HTTP/1.1" 500 -
Bootstrap should be the de facto front-end toolkit for this project.
Runs fine in dev_appserver, but push to appspot and the X-MiniProfiler-Id is getting lost. Sometimes traceback, rest of the time you can't "share" the stats.
traceback:
Traceback (most recent call last):
File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 224, in Handle
for chunk in result:
File "/base/data/home/apps/s~apexbeermenu/1.364030925006454072/flaskext/gae_mini_profiler/profiler.py", line 286, in __call__
yield self.prof.runcall(result.next)
File "/python27_runtime/python27_dist/lib/python2.7/cProfile.py", line 149, in runcall
return func(*args, **kw)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/appstats/recording.py", line 1284, in appstats_wsgi_wrapper
result = app(environ, appstats_start_response)
File "/base/data/home/apps/s~apexbeermenu/1.364030925006454072/flaskext/gae_mini_profiler/profiler.py", line 269, in wrapped_appstats_app
return old_app(environ, start_response)
File "/base/data/home/apps/s~apexbeermenu/1.364030925006454072/flask/app.py", line 1690, in wsgi_app
return response(environ, start_response)
File "/base/data/home/apps/s~apexbeermenu/1.364030925006454072/werkzeug/wrappers.py", line 1083, in __call__
start_response(status, headers)
File "/python27_runtime/python27_lib/versions/1/google/appengine/ext/appstats/recording.py", line 1281, in appstats_start_response
return start_response(status, headers, exc_info)
File "/base/data/home/apps/s~apexbeermenu/1.364030925006454072/flaskext/gae_mini_profiler/profiler.py", line 257, in profiled_start_response
return start_response(status, headers, exc_info)
File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 156, in _StartResponse
(_GetTypeName(value), value, name))
InvalidResponseError: header values must be str, got 'NoneType' (None) for 'X-MiniProfiler-Id'
This is the workaround I did.
http://stackoverflow.com/questions/21242107/pip-install-pil-dont-install-into-virtualenv
Hello,
thanks for maintaining this project, it's really cool useful.
The only problem I've found concerns running the tests in the template. In the tests.py there is a note that the code needs to be updated to Python 2.7 runtime, and I see that there was an issue here on github some time ago concerning this. I think it may be useful to open the issue once again.
I've fiddled around with this for a while, I've went through appengine docs on testing and simply took the code of their testrunner and added it to my app root directory (structure of which is based on your template), I had my own tests and edited them too to fit with gae.
The tests run ok and I'm partly happy with that but the only thing that bothers me is that my tests do not load testing configuration for flask's app.test_client. The tests take their configuration from main application directory and they ignore testing configuration that I pass to them in my tests setUp() method. This is not the end of the world since I'm still on localhost now, so I can find some ways to bypass this, but it slowly starts to irritate me and I'd like to improve this somehow.
So if anyone knows something that might be helpful here I'd be grateful about any information.
Once again thanks for maintaing the project!
Cheers!
Werkzeug's session key handling converts secret keys to strings, throwing a UnicodeDecodeError when the keys are encoded/decoded via base64.
test_404 (tests.DemoTestCase) ... ok
test_admin_login (tests.DemoTestCase) ... FAIL
test_displays_no_data (tests.DemoTestCase) ... FAIL
test_home_redirects (tests.DemoTestCase) ... ok
test_inserts_data (tests.DemoTestCase) ... FAIL
test_says_hello (tests.DemoTestCase) ... ok
Do I have to activate admin_login first somehow?
Many Thanks,
Houman
Hi Kamal,
I have downloaded the latest and followed the instructions:
This is the structure I have.
Yet when I run the application:
(f11-env)hooman@pc:~/workspace/F11-GAE$ ~/workspace/google_appengine/dev_appserver.py src/
it fails, saying that
from flask_wtf.form import Form
ImportError: No module named flask_wtf.form
INFO 2013-06-18 15:09:47,381 server.py:593] default: "GET /_ah/warmup HTTP/1.1" 500 -
But I can see the file in the virtual-env installed.
This is the stack I have installed:
simplejson
Babel==0.9.6
Flask==0.9
Flask-Babel==0.8
Flask-Login==0.2.2
Flask-WTF==0.8.3
Jinja2==2.7
MarkupSafe==0.18
WTForms==1.0.4
Werkzeug==0.8.3
argparse==1.2.1
isodate==0.4.9
passlib==1.6.1
python-dateutil==1.5
pytz==2013b
rauth==0.5.4
requests==1.1.0
speaklater==1.3
wsgiref==0.1.2
In Eclipse all these imports are marked as red as well.
How can I solve these namespace problem? I was expecting this project to solve that problem in first place. :)
Many thanks for advice,
houmie
Hi Kamal,
I just downloaded it and ran "make setup" it ended with the PIL error.
May you please be so kind and advice?
Many Thanks,
houmie
running install_lib
creating /usr/local/lib/python2.7/dist-packages/PIL
error: could not create '/usr/local/lib/python2.7/dist-packages/PIL': Permission denied
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-hooman/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-FUqNKw-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-hooman/PIL
Storing complete log in /home/hooman/.pip/pip.log
make: *** [deps] Error 1
After some more research, it seems that the make file is not activating the created virtualenv after all. Hence the installation seems to happen on the main OS python, hence the permission problem. Best is to remove the make file or fix it properly.
Many Thanks
Create an "admin required" decorator to allow views to be protected by an admin-only flag.
I'm trying to start default application.
ERROR 2012-05-06 17:52:10,278 traceback.py:13] Traceback (most recent call last):
ERROR 2012-05-06 17:52:10,278 traceback.py:13] File "/usr/lib/python2.6/wsgir ef/handlers.py", line 94, in run
ERROR 2012-05-06 17:52:10,278 traceback.py:13] self.finish_response()
ERROR 2012-05-06 17:52:10,278 traceback.py:13] File "/usr/lib/python2.6/wsgiref/handlers.py", line 135, in finish_response
ERROR 2012-05-06 17:52:10,279 traceback.py:13] self.write(data)
ERROR 2012-05-06 17:52:10,279 traceback.py:13] File "/usr/lib/python2.6/wsgiref/handlers.py", line 210, in write
ERROR 2012-05-06 17:52:10,279 traceback.py:13] assert type(data) is StringType,"write() argument must be string"
ERROR 2012-05-06 17:52:10,279 traceback.py:13] AssertionError: write() argument must be string
INFO 2012-05-06 17:52:10,436 dev_appserver.py:2891] "GET /_gae_mini_profiler/static/css/profiler.css HTTP/1.1" 500 -
ERROR 2012-05-06 17:52:10,574 traceback.py:13] Traceback (most recent call last):
ERROR 2012-05-06 17:52:10,574 traceback.py:13] File "/usr/lib/python2.6/wsgiref/handlers.py", line 94, in run
ERROR 2012-05-06 17:52:10,574 traceback.py:13] self.finish_response()
ERROR 2012-05-06 17:52:10,574 traceback.py:13] File "/usr/lib/python2.6/wsgiref/handlers.py", line 135, in finish_response
ERROR 2012-05-06 17:52:10,574 traceback.py:13] self.write(data)
ERROR 2012-05-06 17:52:10,575 traceback.py:13] File "/usr/lib/python2.6/wsgiref/handlers.py", line 210, in write
ERROR 2012-05-06 17:52:10,575 traceback.py:13] assert type(data) is StringType,"write() argument must be string"
ERROR 2012-05-06 17:52:10,575 traceback.py:13] AssertionError: write() argument must be string
INFO 2012-05-06 17:52:10,736 dev_appserver.py:2891] "GET /_gae_mini_profiler/static/js/profiler.js HTTP/1.1" 500 -
Message from Dan Jacob sent to Flask email list on Feb 9, 2011:
"As with frameworks such as Django and Ruby on Rails, Flask-WTF skipped
CSRF validation in the case of AJAX requests as it was deemed safe
enough due to browser same-domain policies. This was to make it more
convenient when writing AJAX code.
However it has since come to light that some browser plugins have made
this feature insecure. A more complete discussion can be found here:
http://www.djangoproject.com/weblog/2011/feb/08/security/
From the latest version of Flask-WTF, 0.5.2, AJAX requests will
automatically do CSRF validation in the same way as any other POST
requests. You can disable this feature by setting CSRF_ENABLED to
False in your settings or by passing csrf_enabled=False in your form
constructor, but this is entirely at your own risk and is not
recommended for production sites.
It is recommended you upgrade to the latest version of Flask-WTF (0.5.2)."
Hello,
Thanks for creating this template, it's been helpful in getting a quick bootstrap to GAE devserver running. I was attempting to use the latest Flask documentation, but quickly realized that the version in this template is 0.9 and not the latest. I attempted to update the Flask library, but it requires the "itsdangerous" module. I've installed this, but Flask doesn't appear to find it. If you're not able to upgrade the template, do you have any ideas why this might be happening and how to resolve it? Thanks.
The README document shows that unit tests are in src/application/tests.py
file, which originally turned me off as I have too many unit tests to place in a single file, plus it mixes test code in with application code.
However it looks like the actual directory layout contains tests in a separate src/tests/
directory, which is more scalable and keeps the test code nicely separated. So this is a request to fix that documentation error in the README :-)
Configure /static folder in App Engine (app.yaml directive) rather than in Flask, to allow expiration headers to be configured in the app.yaml file.
I got one problem that after add/edit/delete an example, the result won't update instantly.
Manually reload the page to see the modification is needed.
This will cause the problem that if user click the delete button, the message won't disappear. The user can press the delete button second time and the website will crash.
maybe try linking to "git clone" the https URL in the readme?
The debugger seems to be broken.
When I published default source to google app engine, it's returning http 500
Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 189, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 227, in _LoadHandler
handler = import(path[0])
File "/base/data/home/apps/sserver/1.361477852260882690/application/init.py", line 7, in server/1.361477852260882690/flaskext/gae_mini_profiler/init.py", line 17, in
from flaskext.gae_mini_profiler import GAEMiniProfiler
File "/base/data/home/apps/s
from flaskext.gae_mini_profiler import profiler
File "/base/data/home/apps/s~server/1.361477852260882690/flaskext/gae_mini_profiler/profiler.py", line 15, in
import simplejson
ImportError: No module named simplejson
After several projects on appengine and a recurring set of problems i thought about writing a template myself, but before doing that i set out to look at what exists... So i've played around with flask-appengine-template and @lipis gae-init ( http://gae-init.appspot.com/ ).
I'm not sure you're aware of each others' project, but I thought i'd let you know. Each of your templates is very cool on its own already. Still i think that joining forces would maybe create something even cooler. Even should you disagree (which is understandable considering the amount of work you both must've put into each of the projects), i still think it's worth looking at each others template cause some things are solved better here, some things better there. So some of the differences i've found:
gae-init:
flask-appengine-template:
So give it a try...
Bit off-topic but as gae-init is on mercurial: there's pretty cool hg via git support: http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/
PS: also posting this on gae-init as an issue: https://bitbucket.org/lipis/gae-init/issue/6
Incorporate werkzeug-debugger-appengine to enable Werkzeug's interactive debugger when running the local development server.
Libraries can be packed in zips that will be unpacked whenever they are needed. This makes things cleaner and saves some space but makes more startup overhead. Do you think this is a good idea?
src/application/static/templates/base.html
src/application/templates/base.html
Replace HTML5Boilerplate's reset CSS styles with YUI 3 Reset/Fonts/Grids and Base CSS framework.
From https://wheel.readthedocs.org/en/latest/ ...
"A wheel is a ZIP-format archive with a specially formatted filename and the .whl extension."
If I run the testrunner.py file as desribed, I get an ImportError because the main module cannot be found:
python testrunner.py ~/Downloads/google_appengine/
Traceback (most recent call last):
File "testrunner.py", line 36, in <module>
main(SDK_PATH, TEST_PATH)
File "testrunner.py", line 21, in main
import main
ImportError: No module named main
I found out (thanks to git/github :)) that once there was a src/main.py file, which was removed for any reason: d848bea
Why was it removed? Is it really no longer needed? If yes, what am I doing wrong or in an outdated way? If it's still needed: give it back!
File "E:\opensource\flask-appengine-template-master\src\pkg_resources.py", line 1694, in find_on_path
for entry in os.listdir(path_item):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 663, in call
raise OSError(errno.EACCES, 'path not accessible', path)
Only support macosx?I'm running the demo on windows,so how to fix that?And what's pkg_resources.py used for?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.