You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
from flask import Flask
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
def create_app(test_config=None):
|
|
# create and configure the app
|
|
app = Flask(__name__, instance_relative_config=True)
|
|
app.config.from_mapping(
|
|
SECRET_KEY='6e674d6e41b733270fd01c6257b3a1b4769eb80f3f773cd0fe8eff25f350fc1f',
|
|
POSTGRES_DB=os.environ.get("POSTGRES_DB", "aact_db"),
|
|
POSTGRES_USER=os.environ.get("POSTGRES_USER", "root"),
|
|
POSTGRES_HOST=os.environ.get("POSTGRES_HOST", "localhost"),
|
|
POSTGRES_PORT=os.environ.get("POSTGRES_PORT", 5432),
|
|
POSTGRES_PASSWORD=os.environ.get("POSTGRES_PASSWORD"),
|
|
)
|
|
|
|
|
|
|
|
# ensure the instance folder exists
|
|
try:
|
|
os.makedirs(app.instance_path)
|
|
except OSError:
|
|
pass
|
|
|
|
# a simple page that says hello
|
|
@app.route('/')
|
|
def hello():
|
|
return 'Hello, World!'
|
|
|
|
|
|
from . import formularies_db_interface
|
|
#init database
|
|
formularies_db_interface.init_database(app)
|
|
|
|
from . import formularies_validation
|
|
app.register_blueprint(formularies_validation.bp)
|
|
|
|
return app
|
|
|
|
|