Skip to content

Commit 29fefda

Browse files
committed
docs: updated readme with setup instructions
1 parent 5e3e33c commit 29fefda

File tree

3 files changed

+97
-18
lines changed

3 files changed

+97
-18
lines changed

Makefile

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.DEFAULT_GOAL=help
44

55
# Define commands to be explicitly invoked
6-
.PHONY: all venv install check clean help run migrate hello
6+
.PHONY: help hello venv install migrate check run clean
77

88
# Define the name of the virtual environment directory
99
VENV_DIR = .venv
@@ -26,28 +26,34 @@ UVICORN = $(VENV_DIR)/bin/uvicorn
2626
# Define the alembic executable within the virtual environment
2727
ALEMBIC = $(VENV_DIR)/bin/alembic
2828

29+
help: ## Show this help
30+
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
31+
2932
hello: ## Hello, World!
3033
@echo "Hello, World!"
3134

32-
# Setup the development environment
33-
all: venv install check
34-
3535
venv: ## Create a virtual environment
3636
$(PYTHON) -m venv $(VENV_DIR)
3737
@echo "Virtual environment created."
3838

39-
install: ## Install development packages
39+
install: ## Install development dependencies
4040
$(PIP) install --upgrade pip
4141
$(PIP) install -r requirements.txt
4242
$(PRE_COMMIT) install
4343
cp .env.example .env
44-
@echo "Development packages has been setup."
44+
@echo "Development dependencies has been setup."
45+
46+
migrate: ## Run the database migration
47+
$(ALEMBIC) upgrade head
4548

4649
check: ## Run all checks using tox and pre-commit
4750
$(TOX)
4851
$(PRE_COMMIT) run --all-files
4952
@echo "All checks passed"
5053

54+
run: ## Run the development server
55+
$(UVICORN) main:app --reload
56+
5157
clean: ## Clean up the project of unneeded files
5258
@echo "Cleaning up the project of unneeded files..."
5359
@rm -rf $(VENV_DIR)
@@ -61,13 +67,3 @@ clean: ## Clean up the project of unneeded files
6167
@find . -name "*.pyc" -delete
6268
@find . -type d -name "__pycache__" -exec rm -r {} +
6369
@echo "Clean up successfully completed."
64-
65-
help: ## Show this help
66-
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
67-
68-
run: ## Run the development server
69-
$(UVICORN) main:app --reload
70-
71-
migrate: ## Run the database migration
72-
$(ALEMBIC) revision --autogenerate
73-
$(ALEMBIC) upgrade head

README.md

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,86 @@
1-
# FastAPI Blog
1+
# FastAPI Project
22

3-
FastAPI boilerplate setup
3+
Welcome to the FastAPI project! Follow these instructions to set up the project on your local machine and get everything running smoothly.
4+
5+
## Prerequisites
6+
7+
Before you begin, the project assumes the following:
8+
9+
- A Linux environment, or WSL (if using Windows)
10+
- Python 3.10 or later installed.
11+
- PostgreSQL installed.
12+
13+
A Makefile has been provided for easy project setup. You can run the command `make` to see all available commands.
14+
15+
## Setup Instructions
16+
17+
- **Clone the Repository**
18+
19+
```bash
20+
git clone https://github.com/Pythonian/fastapi_web.git
21+
```
22+
23+
- Change into the cloned repository
24+
25+
```bash
26+
cd fastapi_web
27+
```
28+
29+
- **Create and Activate the Virtual Environment**
30+
31+
```bash
32+
make venv
33+
```
34+
35+
Activate the virtual environment with the command:
36+
37+
```bash
38+
source .venv/bin/activate
39+
```
40+
41+
*Ensure the virtual environment is activated before running any further commands.*
42+
43+
- **Install Dependencies**
44+
45+
```bash
46+
make install
47+
```
48+
49+
This command will copy an `.env` file into your directory. Open it and update the values before you proceed.
50+
51+
- **Run Database Migrations**
52+
53+
```bash
54+
make migrate
55+
```
56+
57+
- **Run Checks**
58+
59+
Ensure that everything is set up correctly:
60+
61+
```bash
62+
make check
63+
```
64+
65+
- **Run the Development Server**
66+
67+
To start the development server, use:
68+
69+
```bash
70+
make run
71+
```
72+
73+
You can then view the API docs at `http://127.0.0.1:8000/docs/`.
74+
75+
- **Cleaning Up**
76+
77+
To clean up the project directory, removing unnecessary files and directories, use:
78+
79+
```bash
80+
make clean
81+
```
82+
83+
## Credits
84+
85+
- [HNG Boilerplate](https://github.com/hngprojects/hng_boilerplate_python_fastapi_web)
86+
- [FastAPI Tutorial](https://www.youtube.com/playlist?list=PLEt8Tae2spYnHy378vMlPH--87cfeh33P)

__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)