Fix sessions for PostgreSQL backend

This commit is contained in:
RunasSudo 2018-03-26 21:20:19 +11:00
parent 51594687e2
commit b6c0170748
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 7 additions and 1 deletions

View File

@ -70,7 +70,7 @@ if app.config['DB_TYPE'] == 'mongodb':
app.config['SESSION_MONGODB_DB'] = dbinfo.provider.db_name
elif app.config['DB_TYPE'] == 'postgresql':
app.config['SESSION_TYPE'] = 'sqlalchemy'
app.config['SQLALCHEMY_DATABASE_URI'] = dbinfo.provider.conn.dsn
app.config['SQLALCHEMY_DATABASE_URI'] = app.config['DB_URI'] + app.config['DB_NAME']
flask_session.Session(app)
# Set configs
@ -115,6 +115,11 @@ def run_tests(prefix, lang):
import eos.tests
eos.tests.run_tests(prefix, lang)
# Create the session databases (SQL only)
@app.cli.command('sessdb')
def sessdb():
app.session_interface.db.create_all()
# TODO: Will remove this once we have a web UI
@app.cli.command('drop_db_and_setup')
def setup_test_election():

View File

@ -3,6 +3,7 @@ Flask==0.12.2
Flask-Mail==0.9.1
Flask-OAuthlib==0.9.4
Flask-Session==0.3.1
Flask-SQLAlchemy==2.3.2
gunicorn==19.7.1
libsass==0.13.4
premailer==3.1.1