Skip to content

Instantly share code, notes, and snippets.

@Kedrigern
Created April 7, 2025 10:41
Show Gist options
  • Save Kedrigern/c7b80d13520c8d1dc18fb36bbe257271 to your computer and use it in GitHub Desktop.
Save Kedrigern/c7b80d13520c8d1dc18fb36bbe257271 to your computer and use it in GitHub Desktop.
Create skeleton for my most used frameworks
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 <fw> <name>"
echo "FW can be django, wagtail, fastapi, litestar"
exit 1
fi
fw=$1
name=$2
mkdir -p "$name"
create_django() {
echo "Creating Django project $name"
django-admin startproject "$name" "$name"
cd "$name" || exit
uv init
rm hello.py
uv add django
uv add --dev pytest
uv run manage.py migrate
uv run manage.py createsuperuser
echo "Done, run:"
echo "uv run manage.py runserver"
}
create_wagtail() {
echo "Creating Wagtail project $name"
wagtail startproject "$name" "$name"
cd "$name" || exit
uv init
rm hello.py
uv add django
uv add --dev pytest
uv run manage.py migrate
uv run manage.py createsuperuser
echo "Done, run:"
echo "uv run manage.py runserver"
}
create_fastapi() {
cd "$name" || exit
mkdir -p app/tests
touch .env
echo "from fastapi import FastAPI" > app/main.py
echo "" >> app/main.py
echo "app = FastAPI()" >> app/main.py
uv init
rm hello.py
uv add "fastapi[standard]"
uv add --dev pytest ruff
echo "Done, run:"
echo "uv run fastapi dev app/main.py"
}
create_litestar() {
cd "$name" || exit
mkdir -p app/tests
touch .env
echo "from litestar import Litestar, get" > app/main.py
echo "" >> app/main.py
echo "app = Litestar([])" >> app/main.py
uv init
rm hello.py
uv add "litestar[standard]"
uv add --dev pytest ruff
echo "Done, run:"
echo "uv run litestar run"
}
case "$fw" in
django)
create_django
;;
wagtail)
create_wagtail
;;
fastapi)
create_fastapi
;;
litestar)
create_litestar
;;
*)
echo "Neznámá framework: $fw"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment