26 lines
635 B
Python
26 lines
635 B
Python
from datetime import datetime
|
|
|
|
from flask import Flask
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
app = Flask(__name__)
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
|
|
'''
|
|
postgresql://user:password@localhost/mydatabase
|
|
mysql://user:password@localhost/mydatabase
|
|
oracle://user:password@127.0.0.1:1521/mydatabase
|
|
'''
|
|
|
|
db = SQLAlchemy(app)
|
|
|
|
|
|
class Users(db.Model):
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
email = db.Column(db.String(50), unique=True)
|
|
psw = db.Column(db.String(500), nullable=True)
|
|
date = db.Column(db.DateTime, default=datetime.utcnow)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run(debug=True)
|