diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca7976e..ea422ef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ security vulnerability. See our [security policy](https://github.com/scandale-project/pumpkin/security/policy) page. -[FastAPI](https://flask.palletsprojects.com) is used for the backend API. +[FastAPI](https://fastapi.tiangolo.com/) is used for the backend API. Please use [black](https://github.com/psf/black) for the syntax of your Python code. diff --git a/api/database.py b/api/database.py index 0590b74..9cbbad8 100644 --- a/api/database.py +++ b/api/database.py @@ -2,14 +2,18 @@ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker +try: + from instance import config +except Exception: + from instance import example as config DB_CONFIG_DICT = { - "user": "cedric", - "password": "password", - "host": "localhost", - "port": 5432, + "user": config.DB_USERNAME, + "password": config.DB_PASSWORD, + "host": config.DB_HOST, + "port": config.DB_PORT, } -DATABASE_NAME = "pumpkin" +DATABASE_NAME = config.DB_NAME SQLALCHEMY_DATABASE_URI = "postgresql://{user}:{password}@{host}:{port}/{name}".format( name=DATABASE_NAME, **DB_CONFIG_DICT ) diff --git a/instance/example.py b/instance/example.py new file mode 100644 index 0000000..4707fee --- /dev/null +++ b/instance/example.py @@ -0,0 +1,5 @@ +DB_USERNAME = "" +DB_PASSWORD = "" +DB_HOST = "localhost" +DB_PORT = 5432 +DB_NAME = "pumpkin"