page:recipes:csv import tool:flask:attachments

Host CSV Import Tool with Flask: File Attachments

Summary

Deploy a CSV import tool built with Flask on Ample using the browser file uploads pattern. Compute runs the app in an isolated microVM behind a public HTTPS URL. A managed PostgreSQL 16 database is auto-provisioned and injected as DATABASE_URL. A private S3-compatible bucket holds objects with credentials delivered as encrypted environment variables. Verified on Flask:

Treat the CSV import tool-specific behavior as your application code.

Representative Queries

Prerequisites

Workflow Steps

  1. Build and Start
    pip install into .ample/python from requirements.txt, then waitress from app.py reading PORT on the python-3.12 template. The server must bind 0.0.0.0 on PORT.

  2. Implement the Pattern on PostgreSQL
    The fixture's module implements browser file uploads: content-type and size validation that rejects disallowed files. An object is written to a private bucket and a row links the record to the object key.

  3. Wire Object Storage
    Create the bucket(s), then pass endpoint, region, bucket, and keys as --env values.

  4. Deploy
    Run the synchronous deploy once and read the result (exit 0 live, 1 failed, 2 blocked).

  5. Verify
    Fetch the live URL and the pattern self-test route(s) (/p/browser-file-uploads) from the example, then run your own checks.

Success Checks

Limitations

Cost Estimate

Monthly Amount: $10.00 (USD)

Note: Always-on monthly price of the tested sizes; apps and databases auto-pause when idle. Buckets are allocation-priced per quota and not included.

Evidence Summary

Formats