Skip to content

Instantly share code, notes, and snippets.

@bepetersn
Last active August 29, 2015 13:58
Show Gist options
  • Save bepetersn/10371523 to your computer and use it in GitHub Desktop.
Save bepetersn/10371523 to your computer and use it in GitHub Desktop.
Unhelpful Jinja2 Stack Trace
{% extends "_base.html" %}
{% from 'macros.html' import inventory with context %}
{% block preview %}{% endblock preview %}
{% block css %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="css/simple.css" />
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Lusitana:400,400italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400,400italic|Basic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,600,300italic,600italic' rel='stylesheet' type='text/css'>
{% endblock css %}
{% block scripts %}
{{ super() }}
<script src="js/imgLiquid-min.js"></script>
<script src="js/jquery.expander.min.js"></script>
<script src="js/app.js"></script>
{% endblock scripts %}
{% extends "_cpd.html" %}
{% set index = 0 %}
{% block content %}
<div id="index-landing" class="featured-image-wrapper">
<img class="featured-image" src={{ stages[index].featured_image }}>
<h1>Crime and Punishment in Chicago</h1>
<div id="index-overlay">
{{ read_file("content/index_overlay.md")|markdown }}
</div>
<div id="index-injunction" class="scroll-injunction">
<i class="fa fa-chevron-down"></i>
Scroll To Read
<i class="fa fa-chevron-down"></i>
</div>
<div class="photo-caption">
{{ stages[index].image_caption|markdown }}
</div>
</div>
<div class="content container">
<div class="row">
<div id="intro-paragraph" class="copy col-md-6">
{{ read_file("content/index_about.md")|markdown }}
</div>
<div id="intro-paragraph" class="copy col-md-6">
{{ read_file("content/index_data.md")|markdown }}
</div>
</div>
<br><hr><br>
<div id="process" class="row">
<div class="copy col-md-6 col-md-offset-1">
{{ read_file("content/index_rail.md")|markdown }}
</div>
<div class="col-md-4">
<div id="flowchart">
{{ "![](/img/flowchart.jpg)"|markdown }}
</div>
</div>
</div>
<div id="credits" class="row">
<div class="copy col-md-8 col-md-offset-2">
<hr>
{{ read_file("content/credits.md")|markdown }}
</div>
</div>
</div>
<div id='footer'>
<div class='container'>
<a id="next" href="/victimization.html">First Stage: Victimization&nbsp;&nbsp;<i class="fa fa-1x fa-chevron-right"></i></a>
</div>
</div>
{% endblock content %}
(tarbell)copy(master*)$ ls
arrest.html court.html _footer.html index.html LICENSE.md prison.html tarbell_config.py
callforservice.html _cpd.html img jail.html macros.html prosecute.html tarbell_config.pyc
content css incidents.html js _nav.html README.md victimization.html
(tarbell)copy(master*)$ tarbell serve
No _base/base.py file found
Press ctrl-c to stop the server
* Running on http://127.0.0.1:5000/
* Restarting with reloader
No _base/base.py file found
Press ctrl-c to stop the server
/home/brian/Code/tarbell-projects/copy/index.html can't be parsed by Jinja, serving static
Line 9:
{{ read_file("content/index_overlay.md")|markdown }}
Full traceback:
File "/home/brian/.virtualenvs/tarbell/local/lib/python2.7/site-packages/tarbell/app.py", line 321, in preview
rendered = render_template(path, **context)
File "/home/brian/.virtualenvs/tarbell/local/lib/python2.7/site-packages/flask/templating.py", line 127, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/home/brian/.virtualenvs/tarbell/local/lib/python2.7/site-packages/jinja2/environment.py", line 830, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/home/brian/.virtualenvs/tarbell/local/lib/python2.7/site-packages/jinja2/environment.py", line 791, in get_template
return self._load_template(name, self.make_globals(globals))
File "/home/brian/.virtualenvs/tarbell/local/lib/python2.7/site-packages/jinja2/environment.py", line 765, in _load_template
template = self.loader.load(self, name, globals)
File "/home/brian/.virtualenvs/tarbell/local/lib/python2.7/site-packages/jinja2/loaders.py", line 125, in load
code = environment.compile(source, name, filename)
File "/home/brian/.virtualenvs/tarbell/local/lib/python2.7/site-packages/jinja2/environment.py", line 554, in compile
self.handle_exception(exc_info, source_hint=source)
File "/home/brian/.virtualenvs/tarbell/local/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/brian/Code/tarbell-projects/copy/index.html", line 9, in template
{{ read_file("content/index_overlay.md")|markdown }}
127.0.0.1 - - [10/Apr/2014 06:29:20] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [10/Apr/2014 06:29:20] "GET /%7B%7B HTTP/1.1" 404 -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment