tomasemilio / FastAPI-Boilerplate

FastAPI Starter: A simple and intuitive example repository showcasing basic functionality and best practices for building web APIs with FastAPI. Use this as a template or reference for accelerating your FastAPI projects
MIT License
24 stars 2 forks source link

ImportError: cannot import name 'engine' from 'app.database' (E:\11-Projects\FastAPI-Boilerplate\app\database\__init__.py) #3

Closed dannykellett closed 3 weeks ago

dannykellett commented 4 months ago

Hi

Sorry if this seems a simple fix but I get this without changing anything:

File "E:\11-Projects\FastAPI-Boilerplate\app__init__.py", line 6, in from app.api.functions.middleware import add_process_time_header, lifespan File "E:\11-Projects\FastAPI-Boilerplate\app\api\functions\middleware.py", line 8, in from app.database.create import create File "E:\11-Projects\FastAPI-Boilerplate\app\database\create.py", line 4, in from app.database import engine ImportError: cannot import name 'engine' from 'app.database' (E:\11-Projects\FastAPI-Boilerplate\app\database__init__.py) INFO: Stopping reloader process [36892]

tomasemilio commented 4 months ago

@dannykellett Hi Danny, thank you for theobservation. I need to be a bit more verbose with that logic. Did you set in your .env file the corresponding 'DEV_DB_URL'. That's what is happening. I am going to add a default db_url for dev as well and avoid this issue. Thank you!