| 124 | |
| 125 | @app.context_processor |
| 126 | def inject_index_data(): |
| 127 | examples = json.load(open(examples_json)) |
| 128 | # note this appears elsewhere and should probably be done once |
| 129 | # but I'm feeling lazy right now |
| 130 | static_url = settings.STATIC_URL or app.static_url_path |
| 131 | for e in examples: |
| 132 | for key in ["link","thumbnail","source_logo"]: |
| 133 | if not e[key].startswith('http'): |
| 134 | e[key] = urljoin(static_url,e[key]) |
| 135 | |
| 136 | return dict(examples=examples,faqs=json.load(open(faq_json))) |
| 137 | |
| 138 | class APIEncoder(json.JSONEncoder): |
| 139 | def default(self, obj): |