Adding sqlalchemy-utils as a dependency in order to create databases automatically

selenium-screenshot-testing
Kevin Chung 2016-03-12 15:41:06 -05:00
parent 9ebf4c51e8
commit 9ef27ae54b
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ from flask import Flask, render_template, request, redirect, abort, session, jso
from flask.ext.sqlalchemy import SQLAlchemy
from logging.handlers import RotatingFileHandler
from flask.ext.session import Session
from sqlalchemy_utils import database_exists, create_database
import os
import sqlalchemy
@ -13,6 +14,10 @@ def create_app(config='CTFd.config'):
from CTFd.models import db, Teams, Solves, Challenges, WrongKeys, Keys, Tags, Files, Tracking
## sqlite database creation is relative to the script which causes issues with serve.py
if not database_exists(app.config['SQLALCHEMY_DATABASE_URI']) and not app.config['SQLALCHEMY_DATABASE_URI'].startswith('sqlite'):
create_database(app.config['SQLALCHEMY_DATABASE_URI'])
db.init_app(app)
db.create_all()

View File

@ -2,6 +2,7 @@ Flask
Flask-SQLAlchemy
Flask-Session
SQLAlchemy
sqlalchemy-utils
passlib
bcrypt
six