Cloudflare provides a great CDN with no egress charges on bandwidth. The best way to use Cloudflare is through Cloudflare Pages. Using Cloudflare Pages should be pretty straightforward for most frameworks that generate a SPA. However, look at the example below for how to use Cloudflare Pages from asset pipelines for Ruby on Rails and Django.

Django Static Files#

Here is an example of using Github Actions to publish the

    - name: Build Static Files
      run: |
        docker run --env STATIC_ROOT='/static-compiled/' \
                   --env DATABASE_URL='sqlite:///db.sqlite' \
                   -v $PWD/static:/app/static -v $PWD/static-compiled:/static-compiled \
                    python collectstatic --noinput

    - name: Publish Static Files
      uses: cloudflare/[email protected]
        apiToken: ${{ secrets.CF_API_TOKEN }}
        accountId: ${{ secrets.CF_ACCOUNT_ID }}
        command: pages publish ./static-compiled --project-name=opszero-static --commit-dirty=true