from peewee import *
from flask_login import UserMixin
import datetime
import os

from playhouse.db_url import connect

DATABASE = connect(os.environ.get('DATABASE_URL'))

# DATABASE = SqliteDatabase('blogs.sqlite')

class User(UserMixin, Model):
    username = CharField(unique=True)
    email = CharField(unique=True)
    password = CharField()
    image = CharField()

    class Meta:
        database = DATABASE

class Blog(Model):
    title = CharField()
    author = CharField()
    text = CharField()
    # created_at = DateTimeField(default=datetime.datetime.now)
    # created_by = ForeignKeyField(User, backref='blogs')

    class Meta:
        database = DATABASE

def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Blog], safe=True)
    print("Created Tables")
    DATABASE.close()
330e969511d0a324c457061dbf17bc7ad52fa67c
<mask token>


class User(UserMixin, Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


    class Meta:
        database = DATABASE


class Blog(Model):
    title = CharField()
    author = CharField()
    text = CharField()


    class Meta:
        database = DATABASE


<mask token>

<mask token>


class User(UserMixin, Model):
    username = CharField(unique=True)
    email = CharField(unique=True)
    password = CharField()
    image = CharField()


    class Meta:
        database = DATABASE


class Blog(Model):
    title = CharField()
    author = CharField()
    text = CharField()


    class Meta:
        database = DATABASE


def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Blog], safe=True)
    print('Created Tables')
    DATABASE.close()

<mask token>
DATABASE = connect(os.environ.get('DATABASE_URL'))


class User(UserMixin, Model):
    username = CharField(unique=True)
    email = CharField(unique=True)
    password = CharField()
    image = CharField()


    class Meta:
        database = DATABASE


class Blog(Model):
    title = CharField()
    author = CharField()
    text = CharField()


    class Meta:
        database = DATABASE


def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Blog], safe=True)
    print('Created Tables')
    DATABASE.close()

from peewee import *
from flask_login import UserMixin
import datetime
import os
from playhouse.db_url import connect
DATABASE = connect(os.environ.get('DATABASE_URL'))


class User(UserMixin, Model):
    username = CharField(unique=True)
    email = CharField(unique=True)
    password = CharField()
    image = CharField()


    class Meta:
        database = DATABASE


class Blog(Model):
    title = CharField()
    author = CharField()
    text = CharField()


    class Meta:
        database = DATABASE


def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Blog], safe=True)
    print('Created Tables')
    DATABASE.close()

from peewee import *
from flask_login import UserMixin
import datetime
import os

from playhouse.db_url import connect

DATABASE = connect(os.environ.get('DATABASE_URL'))

# DATABASE = SqliteDatabase('blogs.sqlite')

class User(UserMixin, Model):
    username = CharField(unique=True)
    email = CharField(unique=True)
    password = CharField()
    image = CharField()

    class Meta:
        database = DATABASE

class Blog(Model):
    title = CharField()
    author = CharField()
    text = CharField()
    # created_at = DateTimeField(default=datetime.datetime.now)
    # created_by = ForeignKeyField(User, backref='blogs')

    class Meta:
        database = DATABASE

def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Blog], safe=True)
    print("Created Tables")
    DATABASE.close()