13

I am trying to get the flask framework to work with Facebook. I'm doing this with flask_canvas. I followed the example for flask_canvas in the documentation (found here: http://flask-canvas.readthedocs.org/en/latest/) but I keep getting the following error:

AssertionError: View function mapping is overwriting an existing endpoint function: inner

If I comment out the method user(), it will run, but when that method is not commented out, I get the above error.

Any idea how to make it so I can have both the canvas() and user() methods without getting an AssertionError thrown?

import flask_canvas
from flask import Flask, session, redirect
app = Flask(__name__)
flask_canvas.install(app)

HOST = 'localhost'
PORT = 8000

@app.route('/')
def hello_world():
    return 'Hello World!'

# route your canvas-specific page
@app.canvas_route('/app/', methods=['GET','POST'])
def canvas():
    return 'hello, world'

 #route page requiring user data
@app.canvas_route('/user/', methods=['GET','POST'])
def user(canvas_user):
    return canvas_user.request('/me')

if __name__ == '__main__':
    app.run(host = HOST, port = PORT, debug = True)
codegeek
  • 32,236
  • 12
  • 63
  • 63
idungotnosn
  • 2,001
  • 4
  • 29
  • 36
  • 2
    This might help you. http://stackoverflow.com/questions/17256602/assertionerror-view-function-mapping-is-overwriting-an-existing-endpoint-functi – codegeek Nov 13 '13 at 22:01

2 Answers2

17

I had a similar issue, using a decorator without @wraps renames the function being decorated. See this for details http://flask.pocoo.org/docs/patterns/viewdecorators/

11

I encountered this problem, I think there may be two or more inner function in your app.

@app.route('/show1',methods=['GET','POST'])
def show():
    return redirect(url)
@app.route('/show2',methods=['GET','POST'])
def show():
    return redirect(url)

this will tell you an error: AssertionError: View function mapping is overwriting an existing endpoint function: show

poople
  • 165
  • 2
  • 7