A simple Flask Python CRUD app to understand how the basics of CRUD works with a database.
- Framework: Flask
- Database: Postgres
- Authentication: not applicable
- Deployment: Vercel
- Styling: Bootstrap
- Analytics: not applicable
Use the .devcontainer to run the program inside of .devcontainer.
version: '3.8'
services:
app:
image: buildwithdan/flask-crud:latest # Assuming this is the image with everything set up
restart: unless-stopped
ports:
- "5100:5000" # Exposing the Flask app on port 5100 externally. Reminder the logic is HOST:CONTAINER. The container port has to be 5000 as the build image we set it as 5000 in the dockerfile.
depends_on:
- db
db:
image: postgres:latest
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres # Make sure to use secure passwords in production
ports:
- "5432:5432"
volumes:
postgres-data:
This application requires the latest python and flask to be installed.
git clone https://github.com/buildwithdan/flask-crud
cd flask-crud
flask --debug --app api.app run
docker-compose.yml