Let’s use our module now in our /talk/new route to create a new talk.
Within the function for our /talk/new route we’ll add the line to generate a talk title and assign that string to the “talk_title” variable. Finally we’ll just return that talk_title string to the browser.
Here’s what our full app.py
looks like now:
# app.py
from flask import Flask, render_template, redirect, url_for, jsonify, request
from talk_mashup_bot import talk_mashup_bot
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello world!"
@app.route('/talk/new')
def new_talk():
talk_title = talk_mashup_bot.generateTitle()
return talk_title
if __name__ == '__main__':
app.run(debug=True)
Now reload http://localhost:5000/talk/new to see a newly generated talk title.
When you reload the page what talk title did you get? Paste it into chat or unmute to let us know.