This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib2 | |
| import json | |
| url = 'https://api.locu.com/v1_0/venue/search/?locality=lake%20stevens&api_key=9cec4ffbd2988adb04dfdd6ed07e97278861c476' | |
| json_obj = urllib2.urlopen(url) | |
| data = json.load(json_obj) | |
| print data['objects'][2] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| werkzeug.routing.BuildError | |
| BuildError: ('about', {}, None) | |
| Traceback (most recent call last) | |
| File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__ | |
| return self.wsgi_app(environ, start_response) | |
| File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app | |
| response = self.make_response(self.handle_exception(e)) | |
| File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception | |
| reraise(exc_type, exc_value, tb) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, render_template | |
| from datetime import datetime | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def template_test(): | |
| return render_template('template.html', my_string='Wheeeee!', my_list=[0,1,2,3,4,5]) | |
| @app.route("/home") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Flask Template Example</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <style> | |
| div#main { | |
| max-width: 500px; | |
| padding: 20px; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% macro nav_link(endpoint, name) %} | |
| {% if request.endpoint.endswith(endpoint) %} | |
| <a href="{{ url_for(endpoint) }}" class="active">{{name}}</a> | |
| {% else %} | |
| <a href="{{ url_for(endpoint) }}">{{name}}</a> | |
| {% endif %} | |
| {% endmacro %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% from "macros.html" import nav_link with context %} | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Flask Template Example</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <style> | |
| div#main { | |
| max-width: 500px; | |
| padding: 20px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jinja2.exceptions.TemplateSyntaxError | |
| TemplateSyntaxError: expected token 'as', got 'with' | |
| Traceback (most recent call last) | |
| File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__ | |
| return self.wsgi_app(environ, start_response) | |
| File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app | |
| response = self.make_response(self.handle_exception(e)) | |
| File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception | |
| reraise(exc_type, exc_value, tb) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sqlalchemy import create_engine | |
| from sqlalchemy.orm import sessionmaker | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from datetime import datetime | |
| from sqlalchemy import Column, Integer, String, DateTime | |
| engine = create_engine('postgresql://action:action@localhost:5432/tbay') | |
| Session = sessionmaker(bind=engine) | |
| session = Session() | |
| Base = declarative_base() |