from flask import Flask

DB_CONNECTION = "host='localhost' port=5432 user='postgres' password='secret' dbname='antismash'"
SQLALCHEMY_DATABASE_URI = 'postgres://postgres:secret@localhost:5432/antismash'

app = Flask(__name__)
app.config.from_object(__name__)

from .models import db

db.init_app(app)

from . import api
from . import error_handlers

import os
from flask import Flask

SQLALCHEMY_DATABASE_URI = os.getenv('AS_DB_URI', 'postgres://postgres:secret@localhost:5432/antismash')

app = Flask(__name__)
app.config.from_object(__name__)

from .models import db

db.init_app(app)

from . import api
from . import error_handlers

Allow overriding database URI from command line
api: Allow overriding database URI from command line

Signed-off-by: Kai Blin <ad3597797f6179d503c382b2627cc19939309418@biosustain.dtu.dk>

+ import os
  from flask import Flask
  
- DB_CONNECTION = "host='localhost' port=5432 user='postgres' password='secret' dbname='antismash'"
- SQLALCHEMY_DATABASE_URI = 'postgres://postgres:secret@localhost:5432/antismash'
+ SQLALCHEMY_DATABASE_URI = os.getenv('AS_DB_URI', 'postgres://postgres:secret@localhost:5432/antismash')
  
  app = Flask(__name__)
  app.config.from_object(__name__)
  
  from .models import db
  
  db.init_app(app)
  
  from . import api
  from . import error_handlers
  
Allow overriding database URI from command line
## Code Before:
from flask import Flask

DB_CONNECTION = "host='localhost' port=5432 user='postgres' password='secret' dbname='antismash'"
SQLALCHEMY_DATABASE_URI = 'postgres://postgres:secret@localhost:5432/antismash'

app = Flask(__name__)
app.config.from_object(__name__)

from .models import db

db.init_app(app)

from . import api
from . import error_handlers

## Instruction:
Allow overriding database URI from command line
## Code After:
import os
from flask import Flask

SQLALCHEMY_DATABASE_URI = os.getenv('AS_DB_URI', 'postgres://postgres:secret@localhost:5432/antismash')

app = Flask(__name__)
app.config.from_object(__name__)

from .models import db

db.init_app(app)

from . import api
from . import error_handlers
