joshuabach / gnucash-web

A simple, mobile-friendly webinterface for GnuCash
GNU General Public License v3.0
105 stars 16 forks source link

How to run gnucash_web flask #38

Open chdrsto opened 1 year ago

chdrsto commented 1 year ago

I have to admit, I'm running GnucashDB (mariaDB) on a Raspi and would like to enable a web front end to the DB. So I came along to this project.

To be fair, I have no clue about flask and would rather avoid to go too deep into flask setup and configuration.

So, how would i start the flask webserver after I installed it with pip install GnuCash-Web ? I did the configuration in /etc/gnucash_web/config.py ... but have no clue how to start it w/o to learn flask setup

Hope somebody can provide an easy (end user) guide/hint

joshuabach commented 1 year ago

Thank you for trying to use my project, I always appreciate any interest :-)

You really don't need to know much about flask, but you should have some basic understanding of what WSGI is (doesn't matter how it works internally). Basically, WSGI is a python-focused alternative to FastCGI, so a mechanism for a webserver to call the python application based on the URL requested by the user.

At the end of the day, your setup might look like this:

But if you are using apache, using mod_wsgi directly is also an option.

You could start by reading the "Running" section in my Readme and follow the links there. This should help you get it up and running. Especially the guide on the Flask website is useful.

Anyway, I would appreciate if you'd report your results (positive or negative) or any suggestions for improvements in the code or docu back here.

Hope this helps

stevemarkham81 commented 10 months ago

@joshuabach I'm not OP, but I started using your project today, and can report back on exactly what it took to get started. Firstly let me say, this is super cool, and thank you very much.

pip install GnuCash-Web
mkdir .config/gnucash_web
vi ~/.config/gnucash_web/config.py
# [Set up the file as per the README, but with 32 random bytes, sqlite as the DB, and the actual DB file]
pip install uwsgi
pip install Flask==2.2.5  # I had a newer version, and got an error similar to #49  
vi gnucashweb.ini
# [Set up the file as per the README]
uwsgi gnucashweb.ini
# [Experimented a little with a test book and eventually got my real book working after facing #42 (which I fixed by exporting and importing the account tree and the transactions, but probably could have just added a commodity to the root account]

I also added port-forwarding on my router, so that from my phone with Termux I can ssh into my machine, start uwsgi, use GnuCash-Web, then shut it down again. I don't know how to add authentication so that I can leave it running all the time. Maybe I need a proper DB backend instead of sqlite. But anyway, hopefully that short list of commands is something a newbie like me could use to save a few minutes getting started.

plimptm commented 8 months ago

@stevemarkham81 thanks for sharing those details! That's helpful extra documentation.

Personally, for a gnucash 'service' I would not use port forwarding on my router and instead utilize a VPN to get inside my network from a remote location. I use OpenVPN with the Android app and it has been useful for these sorts of things where I don't want to poke new holes in my firewall.

stevemarkham81 commented 8 months ago

@plimptm Funny you should mention it, last week I put WireGuard on my router for another service (Immich). And I must agree, VPNs are a million times easier (and more secure) than port forwarding.