Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vaibhavpandeyvpz/starter-python
Starter template for kick-starting Python API projects.
https://github.com/vaibhavpandeyvpz/starter-python
boilerplace bootstrap fastapi poetry python sqlalchemy starter-project starter-template
Last synced: about 1 month ago
JSON representation
Starter template for kick-starting Python API projects.
- Host: GitHub
- URL: https://github.com/vaibhavpandeyvpz/starter-python
- Owner: vaibhavpandeyvpz
- Created: 2024-05-24T04:59:07.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-24T06:17:22.000Z (6 months ago)
- Last Synced: 2024-06-24T07:36:20.681Z (6 months ago)
- Topics: boilerplace, bootstrap, fastapi, poetry, python, sqlalchemy, starter-project, starter-template
- Language: Python
- Homepage: https://vaibhavpandey.com/
- Size: 81.1 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# starter-python
Starter template for kick-starting [Python](https://www.python.org/) API projects.
## Prepare
Before running the project, go to [ngrok](https://ngrok.com/) and create a free account.
Once logged in, make note of the auth token.## Usage
Run below commands in project folder:
```shell
# create ngrok config
cp ngrok.dist.yml ngrok.yml# update values in ngrok.yml file e.g., your_authtoken_here and domain (optional)
# create app config
cp config.dist.ini config.ini# start the services
docker compose up -d
```Server should be up & running on [127.0.0.1:8000](http://127.0.0.1:8000/).
If you are using [MySQL](https://www.mysql.com) database (powered by [SQLAlchemy](https://www.sqlalchemy.org)), run migrations using below commands:
```shell
# spawn a shell
docker compose exec cron sh -c "poetry shell"# run all migrations
alembic upgrade head
```## Development
This project includes a cron job scheduled to run `poe welcome` command (see `app/cli.py`) every hour.
You can also use below command to run it on demand (or any added command) anytime.```shell
# spawn a shell
docker compose exec cron sh -c "poetry shell"# run "welcome" command
poe welcome
```You can test the API by calling `/` endpoint as below:
```shell
curl -X GET \
-H "accept: application/json" \
http://127.0.0.1:8000/
```To get [ngrok](https://ngrok.com/) public URL from container, use below command (requires [jq](https://jqlang.github.io/jq/)):
```shell
curl --silent -X GET http://localhost:4040/api/tunnels | jq -r '.tunnels[0].public_url'
```