Blood Donor Management App – Flask, MongoDB, Docker & Azure
- Sharon Rajendra Manmothe

- 15 hours ago
- 2 min read
STEP 1 — Create Project in VS Code
Create a folder:
blood-donor-app
Inside create files:
app.py
templates/index.html
requirements.txt
Dockerfile
STEP 2 — MongoDB Atlas Setup
Create free cluster: https://cloud.mongodb.com
Create database user
Network access → Allow from anywhere (0.0.0.0)
Copy Connection String
It looks like:
mongodb+srv://<user>:<pass>@cluster0.xxxx.mongodb.net/blooddb

Replace user/pass.
STEP 3 — requirements.txt
flask
pymongo
dnspython
STEP 4 — Flask Application (app.py)
from flask import Flask, render_template, request
from pymongo import MongoClient
app = Flask(__name__)
# MongoDB Atlas connection
client = MongoClient("YOUR_MONGODB_ATLAS_CONNECTION_STRING")
db = client["blooddb"]
collection = db["donors"]
@app.route("/", methods=["GET", "POST"])
def index():
if request.method == "POST":
name = request.form["name"]
blood = request.form["blood"]
city = request.form["city"]
mobile = request.form["mobile"]
collection.insert_one({
"name": name,
"blood": blood,
"city": city,
"mobile": mobile
})
return render_template("index.html")
@app.route("/search", methods=["POST"])
def search():
keyword = request.form["keyword"]
results = collection.find({
"$or": [
{"name": {"$regex": keyword, "$options": "i"}},
{"blood": {"$regex": keyword, "$options": "i"}},
{"city": {"$regex": keyword, "$options": "i"}}
]
})
return render_template("index.html", results=results)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
STEP 5 — HTML UI (templates/index.html)
<!DOCTYPE html>
<html>
<head>
<title>Blood Donor Registration</title>
</head>
<body>
<h2>Register Blood Donor</h2>
<form method="POST">
Name: <input type="text" name="name" required><br>
Blood Group: <input type="text" name="blood" required><br>
City: <input type="text" name="city" required><br>
Mobile: <input type="text" name="mobile" required><br>
<button type="submit">Register</button>
</form>
<hr>
<h2>Search Donor</h2>
<form method="POST" action="/search">
Keyword: <input type="text" name="keyword">
<button type="submit">Search</button>
</form>
<hr>
{% if results %}
<h3>Search Results</h3>
{% for r in results %}
<p>
{{r.name}} | {{r.blood}} | {{r.city}} | {{r.mobile}}
</p>
{% endfor %}
{% endif %}
</body>
</html>
STEP 6 — Dockerfile
FROM python:3.10
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python", "app.py"]
STEP 7 — Build & Run Docker Locally
docker build -t bloodapp .
docker run -p 5000:5000 bloodapp
Open:
Test register & search
STEP 8 — Create Azure Container Registry (ACR)
az login
az group create --name blood-rg --location centralindia
az acr create --resource-group blood-rg --name bloodacr123 --sku Basic
az acr login --name bloodacr123
STEP 9 — Tag & Push Image to ACR
docker tag bloodapp bloodacr123.azurecr.io/bloodapp:v1
docker push bloodacr123.azurecr.io/bloodapp:v1
STEP 10 — Deploy to Azure Container App
az containerapp env create \
--name blood-env \
--resource-group blood-rg \
--location centralindia
az containerapp create \
--name bloodapp-container \
--resource-group blood-rg \
--environment blood-env \
--image bloodacr123.azurecr.io/bloodapp:v1 \
--target-port 5000 \
--ingress external \
--registry-server bloodacr123.azurecr.io
Azure gives a public URL 🎉
What Students Learn
This single app teaches:
Flask basics
MongoDB Atlas connection
Search using regex
Dockerizing app
Azure Container Registry
Azure Container Apps deployment

$50
Product Title
Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button

$50
Product Title
Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.

$50
Product Title
Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.




Comments