| resources | ||
| templates | ||
| .gitignore | ||
| .gitmodules | ||
| app.py | ||
| config.py | ||
| fonts.py | ||
| gen_image.py | ||
| html_gen.py | ||
| label_printer.service | ||
| LICENSE | ||
| print.py | ||
| process_image.py | ||
| README.md | ||
| requirements.txt | ||
| user_handler.py | ||
Setup
This guide assumes you have a raspberry pi, running raspberry pi os, and your have a user called "techinc". (If you have a different username, you are going to have to change some lines in label_printer.service)
Install
from the techinc home directory:
sudo apt update
sudo apt install python3-flask python3-pil python3-colorama golang git
git clone https://code.techinc.nl/amy/label_printer.git
navigate into the label_printer directory
run make to build the go library
run python3 app.py to test if the webserver starts without errors (to reduce the need for troubleshooting later).
If you get something that looks like:
* Serving Flask app 'app'
* 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:5000
Press CTRL+C to quit
This means things are working as expected. You can quit it by pressing ctrl+C
Installing the systemd daemon
sudo cp label_printer.service to /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable label_printer
sudo systemctl start label_printer
The interface should now be running on localhost:5000, which we need to route to the outside world in the next step
Setup the nginx
sudo apt install nginx
edit /etc/nginx/sites-available/default and change the contents of:
location / { }
to:
location / {
proxy_pass http://127.0.0.1:5000;
}
sudo systemctl restart nginx
Setup static ip on the pi
edit /etc/dhcpcd.conf and add:
static ip_address=10.209.10.2/24
static routers=10.209.10.254
static domain_name_servers=10.209.10.255