pythonassertionerror_关于python:AssertionError:View函数映射正在覆盖现有的端点函数:home – flask...

我正在努力学习http://code.tutsplus.com/tutorials/an-introduction-to-pythons-flask-framework--net-28822

C:\envs\virtalenvs\flask_mini\Scripts\python.exe C:/envs/r2/mini2/intro_to_flask/__init__.py

C:\envs\virtalenvs\flask_mini\lib\site-packages\flask_sqlalchemy\__init__.py:800: UserWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True to suppress this warning.

warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True to suppress this warning.')

Traceback (most recent call last):

File"C:/envs/r2/mini2/intro_to_flask/__init__.py", line 13, in

from routes import mail

File"C:\envs

2\mini2\intro_to_flask

outes.py", line 9, in

@app.route('/')

File"C:\envs\virtalenvs\flask_mini\lib\site-packages\flask\app.py", line 1013, in decorator

self.add_url_rule(rule, endpoint, f, **options)

File"C:\envs\virtalenvs\flask_mini\lib\site-packages\flask\app.py", line 62, in wrapper_func

return f(self, *args, **kwargs)

File"C:\envs\virtalenvs\flask_mini\lib\site-packages\flask\app.py", line 984, in add_url_rule

'existing endpoint function: %s' % endpoint)

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

routes.py文件是:

from intro_to_flask import app

from flask import render_template, request, flash, session, url_for, redirect

from forms import ContactForm, SignupForm, SigninForm

from flask.ext.mail import Message, Mail

from models import db, User

mail = Mail()

@app.route('/')

def home():

return render_template('home.html')

@app.route('/about')

def about():

return render_template('about.html')

@app.route('/contact', methods=['GET', 'POST'])

def contact():

form = ContactForm()

if

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值