I cannot see a log of my print statements output in the terminal. What is missing? Print 1 and Print 2.
application.py code I am testing:
'''
# JSON APIs to view Category Information
@app.route('/catalog/json')
def categoriesJSON():
categories = session.query(Category).all()
categoryList = []
for category in categories:
categoryItems = session.query(CatalogItem).filter_by(
category_id=category.id).all()
categoryItemsList = []
for items in categoryItems:
categoryItemsList.append(items.serialize)
category = category.serialize
category['items'] = categoryItemsList
categoryList.append(category)
print 1
return jsonify(categories=categoryList)
# Show all categories
@app.route('/', methods=['GET'])
@app.route('/catalog/', methods=['GET'])
def showCategories():
categories = session.query(Category).order_by(asc(Category.name))
latest = session.query(CatalogItem).order_by(
CatalogItem.id.desc()).limit(9)
print 2
return render_template('categoryIndex.html', categories=categories,
latest=latest, username=checkUserLogged())
'''
Terminal:
* Detected change in '/Volumes/Sammy/UDACITY/BACKEND/fullstack/vagrant/catalog/application.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 129-965-757
127.0.0.1 - - [28/Mar/2018 18:04:01] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [28/Mar/2018 18:04:04] "GET / HTTP/1.1" 200 -
* Detected change in '/Volumes/Sammy/UDACITY/BACKEND/fullstack/vagrant/catalog/application.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 129-965-757
* Detected change in '/Volumes/Sammy/UDACITY/BACKEND/fullstack/vagrant/catalog/application.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 129-965-757
* Detected change in '/Volumes/Sammy/UDACITY/BACKEND/fullstack/vagrant/catalog/application.py', reloading
* Restarting with stat
* Debugger is active!
* Debugger PIN: 129-965-757
The Chrome dev console error shows as:
"Uncaught Error: Bootstrap's JavaScript requires jQuery"
Does that mean I need to download a jQuery library?
If I am routing /catalog/json
which folder should I be running this application in the terminal? My path is vagrant/catalog/json
. Do I need to be in the vagrant
folder? I am currently in the catalog
folder in my terminal.
In regards to the Bootstrap question:
You don't specifically need to download a jQuery library, you can simply reference it somewhere. But yes, Bootstrap requires jQuery to run.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.