Todo se fue a docker igual que el otro repo

Decidi pasar todo esto a docker igual para tener todo ahi, parece mas
ordenado y mas facil de mantener en mi servidor

de paso tambien hice el trabajo de pasar los modelos a sqlalchemy para
usar mysql :3
This commit is contained in:
Daniel Cortes
2019-03-15 03:16:59 -03:00
parent 6b34e909f2
commit c9ffcb8dca
22 changed files with 253 additions and 264 deletions

53
www/models.py Normal file
View File

@@ -0,0 +1,53 @@
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(255), unique=True, nullable=False)
password = db.Column(db.String(255), nullable=False)
def __init__(self, username=None, password=None):
self.username = username
self.password = password
def __repr__(self):
return f'User {self.username}>'
class Post(db.Model):
__tablename__ = 'posts'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.Text, nullable=False)
markdown = db.Column(db.Text, nullable=False)
html = db.Column(db.Text, nullable=False)
resume = db.Column(db.Text, nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
def __init__(self, title=None, markdown=None, html=None, resume=None):
self.title = title
self.markdown = markdown
self.html = html
self.resume = resume
def __repr__(self):
return f'<Post {self.title} {self.created_at}>'
class Now(db.Model):
__tablename__ = 'nows'
id = db.Column(db.Integer, primary_key=True)
markdown = db.Column(db.Text, nullable=False)
html = db.Column(db.Text, nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
def __init__(self, markdown=None, html=None):
self.markdown = markdown
self.html = html
def __repr__(self):
return f'<Now {self.created_at}>'