如何使用打印语句进行调试?输出未显示在终端日志中



我看不到终端中输出的打印语句的日志。缺什么?打印1并打印2。

application.py代码我正在测试:

'''
# 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())
'''

终端:

 * 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

Chrome Dev控制台错误显示为:

"未被发现的错误:Bootstrap的JavaScript需要jQuery"

这是否意味着我需要下载jQuery库?

如果我正在路由/catalog/json,我应该在终端中运行哪个文件夹?我的道路是vagrant/catalog/json。我需要在vagrant文件夹中吗?我目前在终端中的catalog文件夹中。

关于自举问题:

您不需要特别需要下载 jQuery库,您可以在某个地方引用它。但是,是的,Bootstrap需要jQuery运行。