Made more structural changes. Created a config with definitions to get the ROOT PATH of the project
This commit is contained in:
parent
00257a3251
commit
8b8a218bc5
10 changed files with 16 additions and 12 deletions
3
src/config/definitions.py
Normal file
3
src/config/definitions.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
ROOT_PATH = project_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
|
||||||
from classes import boardgame_classes
|
from src.classes import boardgame_classes
|
||||||
from modules import bgg_connection
|
from src.modules import bgg_connection
|
||||||
|
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
0
src/modules/__init__.py
Normal file
0
src/modules/__init__.py
Normal file
|
|
@ -1,11 +1,16 @@
|
||||||
#Can only be imported on main.py
|
#Can only be imported on bgg_connection.py
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from src.config import definitions
|
||||||
|
|
||||||
username: str = None
|
username: str = None
|
||||||
password: str = None
|
password: str = None
|
||||||
|
|
||||||
auth_secret_file_location = './secrets/auth.yaml'
|
|
||||||
|
auth_secret_file_location = definitions.ROOT_PATH + '/secrets/auth.yaml'
|
||||||
|
|
||||||
|
auth_secret_file_location
|
||||||
|
|
||||||
def load_username_password_from_secrets():
|
def load_username_password_from_secrets():
|
||||||
global username
|
global username
|
||||||
|
|
@ -4,10 +4,9 @@ from pydantic import HttpUrl
|
||||||
import requests
|
import requests
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from classes import boardgame_classes
|
from src.classes import boardgame_classes
|
||||||
from modules import auth_manager
|
from src.modules import auth_manager
|
||||||
|
|
||||||
#from classes.boardgame import BoardGame, BoardGameExpansion, CollectionBoardGame, CollectionBoardGameExpansion, WishlistBoardGame, BoardgameType
|
|
||||||
|
|
||||||
authenticated_session: requests.Session = requests.Session()
|
authenticated_session: requests.Session = requests.Session()
|
||||||
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
from ..main import app
|
from src.main import app
|
||||||
|
|
||||||
#from classes.boardgame_classes import BoardGame, CollectionBoardGame
|
from src.classes import boardgame_classes
|
||||||
#from classes import boardgame_classes
|
|
||||||
from ..classes import boardgame_classes
|
|
||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue