| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project is part of the article I wrote for ThePythonCode.com.
You can check out the article using this link:
It is a tutorial on how to build a GraphQL API in Python using FastAPI (for route handling), Strawberry (for Schema definition and everything GraphQL), and Postgres (the database).
If you decided to follow along the tutorial (or just to run this project), first, make sure you have:
Fork this repo.
Clone it in your local device.
git clone git@github.com:<user>/PythonGQLArticle.git
cd PythonGQLArticleCreate a virtual environment
python3 -m venv pygqlActivate the virtual environment
# MacOS/Linux
source pygql/bin/activate
# Windows
pygql\Scripts\activateInstall the dependencies
pip3 install -r requirements.txtAdd your Database URL - Create a .env file, add your DATABASE URL, and access it in the database.py file:
# .env file
DB_URL='<YOUR DATABASE URL HERE>'# models/database.py
...
SQLALCHEMY_DATABASE_URL = config("DB_URL")Run the server
uvicorn main:app --reloadOpen http://localhost:8000/graphql in your browser.
| Back | FazBrowse Home | New Git URL |