Railway is perfect for this Flask app with SQLite and ML models.
Steps:
- Visit https://railway.app
- Sign up with GitHub
- Click "New Project" → "Deploy from GitHub repo"
- Select your repository
- Railway auto-detects Python and deploys!
- Set environment variable:
SECRET_KEY=your-secret-key-here - Done! Your app is live.
Why Railway?
- ✅ Supports SQLite (persistent storage)
- ✅ Supports ML model files
- ✅ Free tier available
- ✅ Automatic HTTPS
- ✅ Easy database management
Steps:
- Visit https://render.com
- Sign up and connect GitHub
- Click "New" → "Web Service"
- Select your repository
- Configure:
- Name: smart-hospital
- Environment: Python 3
- Build Command:
pip install -r requirements.txt - Start Command:
gunicorn wsgi:app
- Add environment variables:
SECRET_KEY: your-secret-key-hereSESSION_COOKIE_SECURE: True
- Click "Create Web Service"
Free Tier:
- ✅ 750 hours/month free
- ✅ Automatic SSL
- ✅ Persistent disk (paid)
Prerequisites:
# Install Heroku CLI
# Windows: Download from https://devcenter.heroku.com/articles/heroku-cli
# Mac: brew install heroku/brew/heroku
# Linux: curl https://cli-assets.heroku.com/install.sh | shSteps:
# Login to Heroku
heroku login
# Create app
heroku create smart-hospital-queue
# Set environment variables
heroku config:set SECRET_KEY=your-secret-key-here
heroku config:set SESSION_COOKIE_SECURE=True
# Deploy
git push heroku main
# Open app
heroku openNote: Heroku no longer has a free tier, but offers $5/month hobby plan.
Steps:
- Visit https://www.pythonanywhere.com
- Sign up for free account
- Go to "Web" tab
- Click "Add a new web app"
- Choose "Manual configuration" → Python 3.10
- Upload your code via Files tab or Git
- Configure WSGI file:
import sys path = '/home/yourusername/smart-hospital' if path not in sys.path: sys.path.append(path) from wsgi import app as application
- Install requirements in Bash console:
pip install -r requirements.txt
- Reload web app
Free Tier:
- ✅ Always free
- ✅ Custom domain (paid)
⚠️ Limited CPU time
Vercel is designed for serverless functions and doesn't work well with:
- SQLite databases (no persistent storage)
- ML model files
- Background jobs
- Session management
If you must use Vercel:
- Migrate to PostgreSQL
- Store ML models in cloud storage
- Remove background jobs
- See
VERCEL_DEPLOYMENT.mdfor details
For advanced users who want full control:
Create Dockerfile:
FROM python:3.10-slim
WORKDIR /app
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application
COPY . .
# Create instance directory
RUN mkdir -p instance
# Expose port
EXPOSE 8000
# Run application
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "wsgi:app"]Build and run:
# Build image
docker build -t smart-hospital .
# Run container
docker run -p 8000:8000 -v $(pwd)/instance:/app/instance smart-hospitalDeploy to:
- Google Cloud Run
- AWS ECS/Fargate
- Azure Container Apps
- DigitalOcean App Platform
Before deploying, ensure:
- Change
SECRET_KEYin config.py to a strong random value - Set
SESSION_COOKIE_SECURE = Truefor HTTPS - Update
WTF_CSRF_ENABLED = True(currently disabled for testing) - Change default admin password
- Remove debug mode (
debug=False) - Set up proper logging
- Configure email service for password reset
- Test all features locally
- Backup database
Set these in your deployment platform:
SECRET_KEY=your-very-secret-random-key-here
SESSION_COOKIE_SECURE=True
WTF_CSRF_ENABLED=True
FLASK_ENV=productionGenerate a secure SECRET_KEY:
import secrets
print(secrets.token_hex(32))- ✅ Works on: Railway, Render (with persistent disk), Heroku, PythonAnywhere
- ❌ Doesn't work on: Vercel, AWS Lambda, Google Cloud Functions
If you need to scale, migrate to PostgreSQL:
# config.py
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") or \
f"sqlite:///{os.path.join(BASE_DIR, 'instance', 'hospital.db')}"Add to requirements.txt:
psycopg2-binary==2.9.9
For Quick Testing:
- Deploy to Railway (5 minutes)
- Test all features
- Share link with team
For Production:
- Deploy to Render or Railway
- Set up custom domain
- Configure email service
- Set up monitoring
- Regular backups
- ✅
wsgi.py- Production WSGI entry point - ✅
Procfile- Heroku configuration - ✅
railway.json- Railway configuration - ✅
vercel.json- Vercel configuration (not recommended) - ✅
requirements.txt- Updated with gunicorn
Solution: Check logs with heroku logs --tail
Solution: Vercel doesn't support SQLite. Use Railway instead.
Solution: Ensure model files are in repository and path is correct.
Solution: Set WTF_CSRF_ENABLED=True and SESSION_COOKIE_SECURE=True
Deployment Issues:
- Railway: https://railway.app/help
- Render: https://render.com/docs
- Heroku: https://devcenter.heroku.com
Application Issues:
- Check logs in deployment platform
- Review
AUTHENTICATION_GUIDE.md - Check
TESTING_CHECKLIST.md
After successful deployment:
-
Test Login:
- Admin: admin@hospital.com / admin123
- Change admin password immediately!
-
Test Features:
- Patient registration
- Appointment booking
- Admin dashboard
- Doctor management
-
Monitor:
- Check application logs
- Monitor error rates
- Track performance
-
Secure:
- Change default passwords
- Enable CSRF protection
- Set up HTTPS
- Configure firewall
Your Smart Hospital Queue & Appointment Optimizer is now live!
Next Steps:
- Share URL with team
- Train staff on admin portal
- Promote patient portal to patients
- Monitor usage and feedback
Deployment Status: Ready for Railway, Render, Heroku, or PythonAnywhere Recommended: Railway (easiest and free)