From 871a2f97b3da11ef9c412e0598ac1d90b3bfdb6e Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 22 Jun 2015 13:53:55 -0800 Subject: [PATCH] Simple init of db. Don't need migrations. --- app/models.py | 2 +- config.py | 2 +- manage.py | 2 ++ requirements.txt | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models.py b/app/models.py index 18a297a..2093aa9 100644 --- a/app/models.py +++ b/app/models.py @@ -16,7 +16,7 @@ class Community(db.Model): class Dataset(db.Model): __tablename__ = 'datasets' - id = db.Column(db.Integer, primary_key=True + id = db.Column(db.Integer, primary_key=True) datatype = db.Column(db.String(15), nullable=False) model = db.Column(db.String(15), nullable=False) modelname = db.Column(db.String(50), nullable=False) diff --git a/config.py b/config.py index d0cf2cb..d9c1ce8 100644 --- a/config.py +++ b/config.py @@ -16,7 +16,7 @@ class DevelopmentConfig(Config): DEBUG = True SECRET_KEY = os.environ.get('SECRET_KEY') or 'top secret' SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ - 'postgres://user:pass@localhost/akindices' + 'postgres://postgres@localhost/akindices' config = { diff --git a/manage.py b/manage.py index 9c65577..9e15e5a 100644 --- a/manage.py +++ b/manage.py @@ -10,6 +10,8 @@ manager = Manager(app) @manager.command def initdb(): + # Need to import models in order for Flask-SQLAlchemy to create them + from app.models import Community, Dataset, Temperature db.create_all(app=app) diff --git a/requirements.txt b/requirements.txt index a8d4b83..b99a7bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,5 @@ MarkupSafe==0.23 SQLAlchemy==1.0.5 Werkzeug==0.10.4 itsdangerous==0.24 +psycopg2==2.6.1 wsgiref==0.1.2