from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import DeclarativeBase
app = Flask(__name__)
mysql_database = 'mysql://cubinez85:123@localhost/testdb'
engine = create_engine(mysql_database)
class Base(DeclarativeBase): pass
class Person(Base):
__tablename__ = "people"
id = Column(Integer, primary_key=True, index=True)
name = Column(String(64), unique=True, index=True)
age = Column(String(128))
Base.metadata.create_all(bind=engine)
if __name__ == "__main__":
create_db()
app.run(debug=True)
if index < 0:
return False
elif length < 0:
return False
elif index > len(string) - 1:
return False
elif index + length > len(string):
return False
return True
отличается от моего только elif (думал эт не существенно) if index < 0:
return False
elif length < 0:
return False
elif index > len(string) - 1:
return False
elif index + length > len(string):
return False
return True
такой код проходит проверку, elif вместо if,думал эт не существенно
<User admin>
проблема начинается с db.session.add(u)