如果我有2个文件,例如:瓶路由到具有相同名称的功能在不同的模块
moduleA.py
from MyPackage import app
@app.route('/moduleA/get')
def get():
return "a"
moduleB.py
from MyPackage import app
@app.route('/moduleB/get')
def get():
return "b"
和__init__.py
from flask import Flask
import IPython
import logging
app = Flask(__name__,
static_url_path='',
static_folder='static',
template_folder='templates')
from MyPackage import moduleA, moduleB
然后烧瓶会抛出一个错误AssertionError: View function mapping is overwriting an existing endpoint function: get
我认为python本身并没有在这里看到冲突,因为函数是在2个独立的模块中,但是烧瓶的确如此。有没有更好的标准在这里使用,或者我必须使功能名称如def getModuleA
?