statics, DNS issue, delivering file does not work

Trying to get a file like this:

Via flyctl ssh sftp shell I can check:

» ls app/public/

/app is not a symlink, or at least that’s what I’m guessing.
In my Dockerfile I do this:

ADD . /app

The fly.toml looks like this:

app = "myproject"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []


  auto_rollback = true

  processes = ["app"]

    force_https = true
    handlers = ["http"]
    port = 80

    handlers = ["tls"]
    port = 443

  guest_path = "/app/public"
  url_prefix = "/public"

It’s a python app without any webserver. In this case I just try to expose files statically within /app/public.

Currently I get this:

curl -i
curl: (6) Could not resolve host:

This could be failing because statics need to exist in the Docker image. Perhaps, you could try using a python specific statics middleware, something like wsgi-static-middleware · PyPI to see if images are handled properly?

So static files need to exist in the docker image when the fly app is starting? They can’t be i.e. added while the app is running? I.e. download a file and move it into /public to make it (static) aviable to the public?

Oh! :frowning:

These assets are extracted from your Docker image and delivered directly from our proxy on worker hosts.

you could try using a python specific statics middleware, something like wsgi-static-middleware · PyP

Thanks! GitHub - kobinpy/wsgi-static-middleware: WSGI Middleware for serving static files. seems outdated, but found this:
Serving JPG files via wsgiref.simple_server in Python 3 - "write() argument must be a bytes instance" - Stack Overflow

Trying this ““Hello World” WSGI” example now:

Removed the statics part from my toml and adjusted it like this:

    force_https = true
    handlers = ["http"]
    port = 8000

Should this work?
Expected a “hello world”, but getting the resolve issue

curl -i # same for curl -i
curl: (6) Could not resolve host:

Feels like I’m missing something else here. If this is runnign from the deployed Dockerfile do I need to define 8000 in there as well? Not too familiar with this.
Looking at this now: Troubleshooting your Deployment · Fly Docs

Looks like I messed up ports and my app was also missing an ip v4 address.

After some back and forth it’s working. Thanks for the hint.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.