Reputation: 2953
I can't get Flask to redirect!
I keep getting a
File "/Users/kyle.calica-steinhil/Code/wcp2018/wcp18/app/app.py", line 32, in slackRedirect
return redirect(url)
TypeError: 'str' object is not callable
I have no idea why this is not working. I'm passing a string in redirect() I'm pretty sure that's what it takes.
I've also tried '
to "
Code:
slackAPI='https://slack.com/oauth/authorize'
slack_client_id='XXXXXXXXXXXXXXXX'
scope='bot'
redirect='http://localhost:5000/'
@app.route('/auth')
def slackRedirect():
url = slackAPI+'?client_id='+slack_client_id+'&scope='+scope+'&redirect_uri='+redirect
return redirect(url)
Upvotes: 0
Views: 1000
Reputation: 100195
You are redefining what redirect means. redirect
redirects client to target location, so just rename redirect
to something else, following line:
redirect_url='http://localhost:5000/'
Upvotes: 1
Reputation: 3663
The problem you are facing is with naming conflicts. Your module level variable redirect
actually overrides the flask.redirect()
method that you are trying to use:
redirect='http://localhost:5000/'
Rename this redirect
variable to something else and your problem will be solved. That's assuming you've properly imported the flask.redirect
method in your module:
from flask import redirect
Upvotes: 1