我在提交表单时遇到了一些使用url前缀的问题。在模板中似乎没有使用前缀,如果我手动添加前缀,它将复制url\u前缀。。这就是我的意思
mod_auth = Blueprint('auth', __name__, url_prefix='/auth')
@mod_auth.route('/signup', methods=['GET', 'POST'])
def home_page():
if request.method == 'GET': # This works when navigating to /auth/signup
return render_template('/auth/signup.html')
elif request.method == 'POST':
print('test')
form_signup()
在我的模板中。。你知道吗
<form action="/signup" method="post"> # This does not
# work when submitting. It just trys to go to /signup not auth/signup
我也试过了
<form action="auth/signup" method="post"> # This just
#doubles the url it produces.. auth/auth/signup ??
蓝图登记如下:
from app.mod_auth.controllers import mod_auth as auth_module
app.register_blueprint(auth_module)
任何帮助都将不胜感激。我好像找不到这方面的任何信息。你知道吗
我想出来了。你知道吗
模板需要另一个正斜杠。。你知道吗
或者可以使用
url_for()
函数:相关问题 更多 >
编程相关推荐