Closed benlk closed 7 years ago
With that change, we get this:
[cron.nprapps.org] Executing task 'render'
[localhost] local: node_modules/less/bin/lessc less/app.less www/css/app.less.css
[localhost] local: node_modules/less/bin/lessc less/location.less www/css/location.less.css
[localhost] local: node_modules/less/bin/lessc less/oauth.less www/css/oauth.less.css
[localhost] local: node_modules/less/bin/lessc less/table.less www/css/table.less.css
[localhost] local: node_modules/less/bin/lessc less/variables.less www/css/variables.less.css
[localhost] local: node_modules/universal-jst/bin/jst.js --template underscore jst www/js/templates.js
INFO:fabfile.render:2017-08-27 22:53:22,146: Rendering www/location/solana-preserve-vintage-park/index.html
Traceback (most recent call last):
File "/Users/blk/.virtualenvs/harvey/lib/python2.7/site-packages/fabric/main.py", line 756, in main
*args, **kwargs
File "/Users/blk/.virtualenvs/harvey/lib/python2.7/site-packages/fabric/tasks.py", line 387, in execute
multiprocessing
File "/Users/blk/.virtualenvs/harvey/lib/python2.7/site-packages/fabric/tasks.py", line 277, in _execute
return task.run(*args, **kwargs)
File "/Users/blk/.virtualenvs/harvey/lib/python2.7/site-packages/fabric/tasks.py", line 174, in run
return self.wrapped(*args, **kwargs)
File "/Users/blk/sites/localhost/etc/harvey-senior-homes/fabfile/render.py", line 139, in render_all
view = _view_from_name(name)
File "/Users/blk/sites/localhost/etc/harvey-senior-homes/fabfile/render.py", line 39, in _view_from_name
return globals()[module].__dict__[name]
KeyError: Markup(u'solana-preserve-vintage-park')
Here's _view_from_name
:
_view_from_name
is called in render.render_all
, in something like this:
for rule in app.app.url_map.iter_rules():
rule_string = rule.rule
name = rule.endpoint
# Render views, reusing compiled assets
with _fake_context(rule_string):
g.compile_includes = True
g.compiled_includes = compiled_includes
view = _view_from_name(name)
Assuming that the rule and endpoint are from app.py's routing, the problem would appear to be:
for slug in location_ids:
@app.route('/location/%s/' % slug, endpoint=slug)
Printing the name passed to _view_from_name
returns Markup(u'solana-preserve-vintage-park')
, and that's one of the location IDs, wrapped in Markup because, I guess, it's a string from a copytext sheet?
Printing globals()[module].__dict__
during fab production render
returns this monstrosity, which I have split onto separate lines for convenience:
{
'table_redirect': <function table_redirect at 0x10c1527d0>,
'Flask': <class 'flask.app.Flask'>,
'get_location_history_by_slug': <function get_location_history_by_slug at 0x10c1422a8>,
'app': <flask.app.Flask object at 0x10be12a10>,
'CACHE': {'copy': <copytext.Copy object at 0x10c158150>},
'get_location_status_updated_by_slug': <function get_location_status_updated_by_slug at 0x10c142410>,
'static': <module 'static' from '/Users/blk/sites/localhost/etc/harvey-senior-homes/static.pyc'>,
'numbers': <module 'numbers' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/numbers.py'>,
'table': <function table at 0x10c152668>,
'get_location_by_slug': <function get_location_by_slug at 0x10c1421b8>,
'render_template': <function render_template at 0x10b8cb050>,
'redirect': <function redirect at 0x10b6a9b90>,
'index': <function index at 0x10c1525f0>,
'__package__': None,
're': <module 're' from '/Users/blk/.virtualenvs/harvey/lib/python2.7/re.pyc'>,
'json': <module 'json' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.pyc'>,
'collections': <module 'collections' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/collections.pyc'>,
'location': <function location at 0x10c689de8>,
'urlencode_filter': <function urlencode_filter at 0x10be1d668>,
'__doc__': '\nExample application views.\n\nNote that `render_template` is wrapped with `make_response` in all application\nroutes. While not necessary for most Flask apps,
it is required in the\nApp Template for static publishing.\n',
'normalize': <built-in function normalize>,
'__builtins__': {'bytearray': <type 'bytearray'>,
'IndexError': <type 'exceptions.IndexError'>,
'all': <built-in function all>,
'help': Type help() for interactive help,
or help(object) for help about object.,
'vars': <built-in function vars>,
'SyntaxError': <type 'exceptions.SyntaxError'>,
'unicode': <type 'unicode'>,
'UnicodeDecodeError': <type 'exceptions.UnicodeDecodeError'>,
'memoryview': <type 'memoryview'>,
'isinstance': <built-in function isinstance>,
'copyright': Copyright (c) 2001-2015 Python Software Foundation.
All Rights Reserved.
Copyright (c) 2000 BeOpen.com.
All Rights Reserved.
Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.,
'NameError': <type 'exceptions.NameError'>,
'BytesWarning': <type 'exceptions.BytesWarning'>,
'dict': <type 'dict'>,
'input': <built-in function input>,
'oct': <built-in function oct>,
'bin': <built-in function bin>,
'SystemExit': <type 'exceptions.SystemExit'>,
'StandardError': <type 'exceptions.StandardError'>,
'format': <built-in function format>,
'repr': <built-in function repr>,
'sorted': <built-in function sorted>,
'False': False,
'RuntimeWarning': <type 'exceptions.RuntimeWarning'>,
'list': <type 'list'>,
'iter': <built-in function iter>,
'reload': <built-in function reload>,
'Warning': <type 'exceptions.Warning'>,
'__package__': None,
'round': <built-in function round>,
'dir': <built-in function dir>,
'cmp': <built-in function cmp>,
'set': <type 'set'>,
'bytes': <type 'str'>,
'reduce': <built-in function reduce>,
'intern': <built-in function intern>,
'issubclass': <built-in function issubclass>,
'Ellipsis': Ellipsis,
'EOFError': <type 'exceptions.EOFError'>,
'locals': <built-in function locals>,
'BufferError': <type 'exceptions.BufferError'>,
'slice': <type 'slice'>,
'FloatingPointError': <type 'exceptions.FloatingPointError'>,
'sum': <built-in function sum>,
'getattr': <built-in function getattr>,
'abs': <built-in function abs>,
'exit': Use exit() or Ctrl-D (i.e. EOF) to exit,
'print': <built-in function print>,
'True': True,
'FutureWarning': <type 'exceptions.FutureWarning'>,
'ImportWarning': <type 'exceptions.ImportWarning'>,
'None': None,
'hash': <built-in function hash>,
'ReferenceError': <type 'exceptions.ReferenceError'>,
'len': <built-in function len>,
'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
for supporting Python development. See www.python.org for more information.,
'frozenset': <type 'frozenset'>,
'__name__': '__builtin__',
'ord': <built-in function ord>,
'super': <type 'super'>,
'TypeError': <type 'exceptions.TypeError'>,
'license': The MIT License (MIT)
Copyright (c) 2014 NPR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
,
'KeyboardInterrupt': <type 'exceptions.KeyboardInterrupt'>,
'UserWarning': <type 'exceptions.UserWarning'>,
'filter': <built-in function filter>,
'range': <built-in function range>,
'staticmethod': <type 'staticmethod'>,
'SystemError': <type 'exceptions.SystemError'>,
'BaseException': <type 'exceptions.BaseException'>,
'pow': <built-in function pow>,
'RuntimeError': <type 'exceptions.RuntimeError'>,
'float': <type 'float'>,
'MemoryError': <type 'exceptions.MemoryError'>,
'StopIteration': <type 'exceptions.StopIteration'>,
'globals': <built-in function globals>,
'divmod': <built-in function divmod>,
'enumerate': <type 'enumerate'>,
'apply': <built-in function apply>,
'LookupError': <type 'exceptions.LookupError'>,
'open': <built-in function open>,
'quit': Use quit() or Ctrl-D (i.e. EOF) to exit,
'basestring': <type 'basestring'>,
'UnicodeError': <type 'exceptions.UnicodeError'>,
'zip': <built-in function zip>,
'hex': <built-in function hex>,
'long': <type 'long'>,
'next': <built-in function next>,
'ImportError': <type 'exceptions.ImportError'>,
'chr': <built-in function chr>,
'xrange': <type 'xrange'>,
'type': <type 'type'>,
'__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.",
'Exception': <type 'exceptions.Exception'>,
'tuple': <type 'tuple'>,
'UnicodeTranslateError': <type 'exceptions.UnicodeTranslateError'>,
'reversed': <type 'reversed'>,
'UnicodeEncodeError': <type 'exceptions.UnicodeEncodeError'>,
'IOError': <type 'exceptions.IOError'>,
'hasattr': <built-in function hasattr>,
'delattr': <built-in function delattr>,
'setattr': <built-in function setattr>,
'raw_input': <built-in function raw_input>,
'SyntaxWarning': <type 'exceptions.SyntaxWarning'>,
'compile': <built-in function compile>,
'ArithmeticError': <type 'exceptions.ArithmeticError'>,
'str': <type 'str'>,
'property': <type 'property'>,
'GeneratorExit': <type 'exceptions.GeneratorExit'>,
'int': <type 'int'>,
'__import__': <built-in function __import__>,
'KeyError': <type 'exceptions.KeyError'>,
'coerce': <built-in function coerce>,
'PendingDeprecationWarning': <type 'exceptions.PendingDeprecationWarning'>,
'file': <type 'file'>,
'EnvironmentError': <type 'exceptions.EnvironmentError'>,
'unichr': <built-in function unichr>,
'id': <built-in function id>,
'OSError': <type 'exceptions.OSError'>,
'DeprecationWarning': <type 'exceptions.DeprecationWarning'>,
'min': <built-in function min>,
'UnicodeWarning': <type 'exceptions.UnicodeWarning'>,
'execfile': <built-in function execfile>,
'any': <built-in function any>,
'complex': <type 'complex'>,
'bool': <type 'bool'>,
'ValueError': <type 'exceptions.ValueError'>,
'NotImplemented': NotImplemented,
'map': <built-in function map>,
'buffer': <type 'buffer'>,
'max': <built-in function max>,
'object': <type 'object'>,
'TabError': <type 'exceptions.TabError'>,
'callable': <built-in function callable>,
'ZeroDivisionError': <type 'exceptions.ZeroDivisionError'>,
'eval': <built-in function eval>,
'__debug__': True,
'IndentationError': <type 'exceptions.IndentationError'>,
'AssertionError': <type 'exceptions.AssertionError'>,
'classmethod': <type 'classmethod'>,
'UnboundLocalError': <type 'exceptions.UnboundLocalError'>,
'NotImplementedError': <type 'exceptions.NotImplementedError'>,
'AttributeError': <type 'exceptions.AttributeError'>,
'OverflowError': <type 'exceptions.OverflowError'>},
'get_location_ids': <function get_location_ids at 0x10c142140>,
'__file__': '/Users/blk/sites/localhost/etc/harvey-senior-homes/app.pyc',
'get_copy': <function get_copy at 0x10c142050>,
'smarty_filter': <function smarty_filter at 0x10be1d6e0>,
'format_zip': <function format_zip at 0x10c140f50>,
'app_config': <module 'app_config' from '/Users/blk/sites/localhost/etc/harvey-senior-homes/app_config.pyc'>,
'get_location_status_by_slug': <function get_location_status_by_slug at 0x10c142320>,
'oauth': <module 'oauth' from '/Users/blk/sites/localhost/etc/harvey-senior-homes/oauth.pyc'>,
'__name__': 'app',
'copytext': <module 'copytext' from '/Users/blk/.virtualenvs/harvey/lib/python2.7/site-packages/copytext.pyc'>,
'logger': <logging.Logger object at 0x10c148090>,
'make_context': <function make_context at 0x10be1d5f0>,
'get_locations_statuses': <function get_locations_statuses at 0x10c142230>,
'slug': Markup(u'brookdale-kingwood'),
'logging': <module 'logging' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.pyc'>,
'make_response': <function make_response at 0x10b8a37d0>,
'get_locations': <function get_locations at 0x10c1420c8>,
'DebuggedApplication': <class 'werkzeug.DebuggedApplication'>,
'wsgi_app': <werkzeug.DebuggedApplication object at 0x10c232790>,
'embedding': <function embedding at 0x10c152758>,
'get_location_status_color_by_slug': <function get_location_status_color_by_slug at 0x10c142398>,
'location_ids': [Markup(u'fpn-455999'),
Markup(u'fpn-455728'),
Markup(u'fpn-455557'),
Markup(u'fpn-455575'),
Markup(u'fpn-455687'),
Markup(u'fpn-455697'),
Markup(u'fpn-675487'),
Markup(u'fpn-675637'),
Markup(u'fpn-675670'),
Markup(u'fpn-675672'),
Markup(u'fpn-675717'),
Markup(u'fpn-675773'),
Markup(u'fpn-676087'),
Markup(u'fpn-676107'),
Markup(u'fpn-676303'),
Markup(u'fpn-676321'),
Markup(u'fpn-455643'),
Markup(u'fpn-675899'),
Markup(u'fpn-455582'),
Markup(u'fpn-675850'),
Markup(u'fpn-675495'),
Markup(u'fpn-676264'),
Markup(u'fpn-675556'),
Markup(u'fpn-675696'),
Markup(u'fpn-455477'),
Markup(u'fpn-676307'),
Markup(u'fpn-675557'),
Markup(u'fpn-675684'),
Markup(u'fpn-675159'),
Markup(u'fpn-455838'),
Markup(u'fpn-675086'),
Markup(u'fpn-455726'),
Markup(u'fpn-455333'),
Markup(u'fpn-455613'),
Markup(u'fpn-455682'),
Markup(u'fpn-455714'),
Markup(u'fpn-455756'),
Markup(u'fpn-455756'),
Markup(u'fpn-455794'),
Markup(u'fpn-455800'),
Markup(u'fpn-455805'),
Markup(u'fpn-455815'),
Markup(u'fpn-455854'),
Markup(u'fpn-455981'),
Markup(u'fpn-675000'),
Markup(u'fpn-675078'),
Markup(u'fpn-675080'),
Markup(u'fpn-675085'),
Markup(u'fpn-675231'),
Markup(u'fpn-675233'),
Markup(u'fpn-675297'),
Markup(u'fpn-675370'),
Markup(u'fpn-675423'),
Markup(u'fpn-675454'),
Markup(u'fpn-675493'),
Markup(u'fpn-675543'),
Markup(u'fpn-675555'),
Markup(u'fpn-675612'),
Markup(u'fpn-675667'),
Markup(u'fpn-675671'),
Markup(u'fpn-675764'),
Markup(u'fpn-675777'),
Markup(u'fpn-675789'),
Markup(u'fpn-675789'),
Markup(u'fpn-675791'),
Markup(u'fpn-675793'),
Markup(u'fpn-675793'),
Markup(u'fpn-675818'),
Markup(u'fpn-675819'),
Markup(u'fpn-675834'),
Markup(u'fpn-675986'),
Markup(u'fpn-676009'),
Markup(u'fpn-676021'),
Markup(u'fpn-676059'),
Markup(u'fpn-676066'),
Markup(u'fpn-676081'),
Markup(u'fpn-676111'),
Markup(u'fpn-676116'),
Markup(u'fpn-676137'),
Markup(u'fpn-676152'),
Markup(u'fpn-676170'),
Markup(u'fpn-676208'),
Markup(u'fpn-676230'),
Markup(u'fpn-676236'),
Markup(u'fpn-676239'),
Markup(u'fpn-676251'),
Markup(u'fpn-676252'),
Markup(u'fpn-676258'),
Markup(u'fpn-676282'),
Markup(u'fpn-676306'),
Markup(u'fpn-676310'),
Markup(u'fpn-676314'),
Markup(u'fpn-676333'),
Markup(u'fpn-676336'),
Markup(u'fpn-676337'),
Markup(u'fpn-676354'),
Markup(u'fpn-676356'),
Markup(u'fpn-676362'),
Markup(u'la-vita-bella'),
Markup(u'fpn-676222'),
Markup(u'fpn-675799'),
Markup(u'fpn-676083'),
Markup(u'fpn-676107'),
Markup(u'fpn-675635'),
Markup(u'fpn-675785'),
Markup(u'fpn-676180'),
Markup(u'fpn-675606'),
Markup(u'fpn-455599'),
Markup(u'fpn-676218'),
Markup(u'fpn-675815'),
Markup(u'fpn-676133'),
Markup(u'fpn-455797'),
Markup(u'fpn-676245'),
Markup(u'fpn-676119'),
Markup(u'fpn-676299'),
Markup(u'fpn-675395'),
Markup(u'fpn-675942'),
Markup(u'fpn-657395'),
Markup(u'fpn-676037'),
Markup(u'fpn-675361'),
Markup(u'fpn-675206'),
Markup(u'fpn-676125'),
Markup(u'fpn-676391'),
Markup(u'fpn-675409'),
Markup(u'fpn-675956'),
Markup(u'fpn-675380'),
Markup(u'fpn-676371'),
Markup(u'fpn-675736'),
Markup(u'fpn-675744'),
Markup(u'fpn-675699'),
Markup(u'fpn-676260'),
Markup(u'fpn-675254'),
Markup(u'fpn-455490'),
Markup(u'fpn-675214'),
Markup(u'brookdale-trinity-towers'),
Markup(u'brookdale-corpus-christi'),
Markup(u'brookdale-northshore'),
Markup(u'brookdale-victoria'),
Markup(u'brookdale-copperfield'),
Markup(u'brookdale-clear-lake'),
Markup(u'brookdale-friendswood'),
Markup(u'brookdale-ellington-field'),
Markup(u'brookdale-pearland'),
Markup(u'brookdale-dowlen-oaks'),
Markup(u'brookdale-first-colony'),
Markup(u'sycamores-sugar-land'),
Markup(u'brookdale-sugar-land'),
Markup(u'brookdale-memorial-city'),
Markup(u'brookdale-memorial-oaks'),
Markup(u'brookdale-shadowlake'),
Markup(u'brookdale-spring-shadows'),
Markup(u'brookdale-tanglewood'),
Markup(u'brookdale-the-heights'),
Markup(u'brookdale-west-university'),
Markup(u'brookdale-cy-fair'),
Markup(u'solana-preserve-vintage-park'),
Markup(u'solana-vintage-park'),
Markup(u'brookdale-willowbrook-place'),
Markup(u'brookdale-willowbrook-park'),
Markup(u'village-gleannloch-farms'),
Markup(u'brookdale-champion-oaks'),
Markup(u'brookdale-cypress-station'),
Markup(u'brookdale-kingwood')],
'itemgetter': <type 'operator.itemgetter'>
}
Markup(u'solana-preserve-vintage-park')
is in there.
guh.
It's in there, but it's not a key.
Reading http://flask.pocoo.org/docs/0.12/api/#flask.Flask.route , I believe that the reason here is because I specified the endpoint
parameter, when it should've been left to its default.
endpoint – the endpoint for the registered URL rule. Flask itself assumes the name of the view function as endpoint
Yeah, that was it. Rendered successfully locally.
Build, you monster.
Resolved.
Running
fab production render
gives this:The 'skipping' lines are from the render.render_all task, which skips paths that don't end in certain ways:
https://github.com/benlk/harvey-senior-homes/blob/74cb7f65555592c88a44e356040372d05169611b/fabfile/render.py#L117-L124
So the solution would appear to be to make sure that all the locations end in a /.