mliezun / caddy-snake

Caddy plugin to serve Python apps
MIT License
68 stars 2 forks source link

JSON Config #14

Closed cplmayo closed 2 months ago

cplmayo commented 2 months ago

I'm still pretty new to Caddy and I'm trying to implement this in place of Gunicorn for my app. I'm trying to just test locally so I can get the config correct but I'm getting errors from the example config.

Do you have an example of this implemented in JSON?

If not maybe some flavor on:

{
    http://localhost:9080 {
        route {
            python {
                module_wsgi "main:app"
            }
        }
    }
}

I'm getting this error and haven't found anything so wanted to drop the question here.

caddy run --config caddyfile
2024/05/11 18:59:31.873 INFO    using provided configuration    {"config_file": "caddyfile", "config_adapter": ""}
Error: loading initial config: decoding request body: invalid character 'h' looking for beginning of object key string

I'm sure I'm missing something simple but I'm just not seeing it.

Verified: I'm an idiot; I didn't realize xcaddy was compiling a new bin and I needed to use that one to run. Sorry to bump everyone's emails for nothing.

mliezun commented 2 months ago

Hi @cplmayo!

Apart from the caddy binary created by xcaddy, I think you have an extra set of brackets enclosing everything.

Happy to help 😁