tmkontra / fastapi-fullstack-boilerplate Goto Github PK
View Code? Open in Web Editor NEWA full stack (monolith) boilerplate for FastAPI
License: MIT License
A full stack (monolith) boilerplate for FastAPI
License: MIT License
Hi ttymck, thank you for sharing your project! It's great!
I ran into few issues in calling /api
, after some research I fixed. I would like to share my fix:
for .env.example
, the DB_URL should be:
DB_URL='postgresql+psycopg2://${DB_HOST}/${DB_NAME}'
for dependencies.py
, there should have a new function for APIRoutes
class:
def get_db():
with get_db_session() as db:
return db
in main.py
, APIRoutes depends should be:
from .dependencies import get_db, Templates, Render
db: Session = Depends(get_db)
thanks for your sharing!
@ttymck looks like a a great code. However I am getting the following error on the first, wanna check if you might know the fix?
Tried googling, not much help.
((fastapi-fullstack-boilerplate) ) coder@MYSERVER:~/mynotes/fastapi/fastapi-fullstack-boilerplate$ uvicorn --factory app.main:create_app --reload --port=8080
INFO: Will watch for changes in these directories: ['/home/coder/mynotes/fastapi/fastapi-fullstack-boilerplate']
INFO: Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit)
INFO: Started reloader process [31471] using statreload
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/coder/.local/share/virtualenvs/fastapi-fullstack-boilerplate-IipA4anG/lib/python3.8/site-packages/uvicorn/subprocess.py", line 76, in subprocess_started
target(sockets=sockets)
File "/home/coder/.local/share/virtualenvs/fastapi-fullstack-boilerplate-IipA4anG/lib/python3.8/site-packages/uvicorn/server.py", line 68, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/coder/.local/share/virtualenvs/fastapi-fullstack-boilerplate-IipA4anG/lib/python3.8/site-packages/uvicorn/server.py", line 76, in serve
config.load()
File "/home/coder/.local/share/virtualenvs/fastapi-fullstack-boilerplate-IipA4anG/lib/python3.8/site-packages/uvicorn/config.py", line 454, in load
self.loaded_app = self.loaded_app()
File "/home/coder/mynotes/fastapi/fastapi-fullstack-boilerplate/./app/main.py", line 53, in create_app
static_digest = StaticDigest(source_dir=settings.STATIC_DIR)
File "/home/coder/.local/share/virtualenvs/fastapi-fullstack-boilerplate-IipA4anG/lib/python3.8/site-packages/fastapi_static_digest/digest.py", line 51, in __init__
self.manifest = self._load_manifest()
File "/home/coder/.local/share/virtualenvs/fastapi-fullstack-boilerplate-IipA4anG/lib/python3.8/site-packages/fastapi_static_digest/digest.py", line 54, in _load_manifest
with open(self.manifest_file, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/coder/mynotes/fastapi/fastapi-fullstack-boilerplate/app/static/_digest/cache_manifest.json'
Here are my steps:
pip install pipenv
pipenv shell
pipenv install --dev
uvicorn --factory app.main:create_app --reload --port=8080
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.