Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@
from base64 import b64encode, urlsafe_b64encode
import random
from pathlib import Path
from flask_migrate import upgrade
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate


app = Flask(__name__)

db = SQLAlchemy()
db.init_app(app)
Migrate(app, db)

# Load .env settings
curDir = os.path.dirname(os.path.realpath(__file__))
app.config.from_pyfile('/'.join([curDir, '.env']))
Expand Down Expand Up @@ -74,10 +83,10 @@ def deploy():
print(call)

shutil.move(''.join([dstDir, 'subscribie/', 'data.db']), dstDir)
# Run subscribie_cli migrations
subprocess.call('export LC_ALL=C.UTF-8; export LANG=C.UTF-8; subscribie migrate --DB_FULL_PATH ' + dstDir + \
'data.db', \
cwd = ''.join([dstDir, 'subscribie']), shell=True)

# Migrate the database
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + dstDir + 'data.db'
upgrade(directory=dstDir + 'subscribie/migrations')

# Seed users table with site owners email address so they can login
fp = open(dstDir + 'jamla.yaml', 'r')
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ flask_mail
GitPython
requests>=2.20.0
pyyaml
flask_sqlalchemy
flask_migrate