mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 14:34:21 +01:00
Adding sqlalchemy-utils as a dependency in order to create databases automatically
This commit is contained in:
@@ -2,6 +2,7 @@ from flask import Flask, render_template, request, redirect, abort, session, jso
|
|||||||
from flask.ext.sqlalchemy import SQLAlchemy
|
from flask.ext.sqlalchemy import SQLAlchemy
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
from flask.ext.session import Session
|
from flask.ext.session import Session
|
||||||
|
from sqlalchemy_utils import database_exists, create_database
|
||||||
import os
|
import os
|
||||||
import sqlalchemy
|
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
|
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.init_app(app)
|
||||||
db.create_all()
|
db.create_all()
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ Flask
|
|||||||
Flask-SQLAlchemy
|
Flask-SQLAlchemy
|
||||||
Flask-Session
|
Flask-Session
|
||||||
SQLAlchemy
|
SQLAlchemy
|
||||||
|
sqlalchemy-utils
|
||||||
passlib
|
passlib
|
||||||
bcrypt
|
bcrypt
|
||||||
six
|
six
|
||||||
|
|||||||
Reference in New Issue
Block a user