relative imports

This commit is contained in:
Jörn-Michael Miehe 2022-03-15 16:25:07 +00:00
parent 18b1cb21f9
commit 411c584480
5 changed files with 14 additions and 12 deletions

View file

@ -1,8 +1,7 @@
#!/usr/bin/env python3
from kiwi_vpn_api.config import CRYPT_CONTEXT, DB
from kiwi_vpn_api.db.model import (Certificate, DistinguishedName, User,
UserCapability)
from ..config import CRYPT_CONTEXT, DB
from .model import Certificate, DistinguishedName, User, UserCapability
def main():

View file

@ -3,10 +3,11 @@ from __future__ import annotations
import datetime
from typing import Optional
from kiwi_vpn_api.config import CRYPT_CONTEXT, DB
from peewee import (BooleanField, CharField, DateTimeField, ForeignKeyField,
Model)
from ..config import CRYPT_CONTEXT, DB
class BaseModel(Model):
class Meta:

View file

@ -3,8 +3,8 @@
import uvicorn
from fastapi import FastAPI
from kiwi_vpn_api.config import PRODUCTION_MODE
from kiwi_vpn_api.routers import auth, user
from .config import PRODUCTION_MODE
from .routers import auth, user
api = FastAPI(
title="kiwi-vpn API",

View file

@ -3,11 +3,12 @@ from datetime import datetime, timedelta
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from jose import jwt
from kiwi_vpn_api.config import (ACCESS_TOKEN_EXPIRE_MINUTES, ALGORITHM,
CRYPT_CONTEXT, SECRET_KEY)
from kiwi_vpn_api.db.model import User
from pydantic import BaseModel
from ..config import (ACCESS_TOKEN_EXPIRE_MINUTES, ALGORITHM, CRYPT_CONTEXT,
SECRET_KEY)
from ..db.model import User
router = APIRouter(prefix="/auth")
SCHEME = OAuth2PasswordBearer(
tokenUrl=f".{router.prefix}/token"

View file

@ -4,11 +4,12 @@ from typing import Optional
from fastapi import APIRouter, Depends, HTTPException, status
from jose import JWTError, jwt
from kiwi_vpn_api.routers.auth import SCHEME
from kiwi_vpn_api.config import ALGORITHM, SECRET_KEY
from kiwi_vpn_api.db.model import User as db_User
from pydantic import BaseModel
from ..config import ALGORITHM, SECRET_KEY
from ..db.model import User as db_User
from .auth import SCHEME
router = APIRouter(prefix="/user")