coleifer / sqlite-web

Web-based SQLite database browser written in Python
MIT License
3.42k stars 339 forks source link

Headless operation does not work #130

Closed jeffehobbs closed 1 year ago

jeffehobbs commented 1 year ago

If I want to run sql-lite headless on a raspberry pi, I install all the required packages and then run:

sqlite_web -x data.sqlite

And when I do this, I get:

 * Serving Flask app 'sqlite_web.sqlite_web'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:8080
Press CTRL+C to quit

When I try to access this server via another machine via the .local address, it does not resolve. And indeed, an nmap scan of the raspberry pi shows the port 8080 is not reachable.

When I try the same process on my Mac, not headless, it works perfectly.

Any idea what I could be missing? Using the debug mode does not help, as nothing actually reaches the flask server to produce debug console output. The Raspberry Pi has stock software, no firewall.

Thanks for any clues.

coleifer commented 1 year ago

I don't mean to be rude but it says it literally right there.

Running on http://127.0.0.1:8080

You need to set the host to, e.g. 0.0.0.0 for it to be visible on the network.

jeffehobbs commented 1 year ago

Thanks? Other Flask apps do not act like this, for the record.

For anyone stuck like I was, the command to operate this app headless was:

sqlite_web -x -H 0.0.0.0 path/to/your/data.sqlite

coleifer commented 1 year ago

We use safe defaults, you don't want to be exposing your database to the Internet. The people most likely to accidentally expose their db are the ones who will not know they need to secure it in the first place.

jeffehobbs commented 1 year ago

Totally makes sense, just not what I was expecting. Thanks for the assist.