A Raspberry Pi Zero home server application built using Python, Django, HTMX and SQLite.
- Install Python 3.9 with your system package manager, or by visiting python.org.
- Run the
setup.shscript to create the virtual environment and install packages. - Fill your desired configuration into the
.envfile.
- Activate the Python virtual environment:
source .venv/bin/activate - Change into the
srcdirectory:cd src - If needed, migrate the database:
python manage.py migrate - Run the Django application in development mode:
python manage.py runserver
- Use the Raspberry Pi Imager to install Raspbian onto a device. Set up the device to connect to your network and create SSH keys to securely connect.
- Connect to the Raspberry Pi using
ssh. - Install the required packages:
sudo apt-get install nginx python3-venv libopenblas-dev
- Return to the project on your development machine.
- Create a file named
.pienvand copy the keys from.pienv.defaultinto it. Then fill in your desired configuration. - Run the
deploy/update.shscript to sync project files to the Raspberry Pi. - SSH back into the Raspberry Pi, then follow the
Project Setupsteps using theprod.txtrequirements. - Copy the configuration files into the system directory:
sudo cp config/app.socket /etc/systemd/system/
sudo cp config/app.service /etc/systemd/system/
- Run the following code to enable the application:
sudo systemctl start app.socket
sudo systemctl enable app.socket
sudo systemctl daemon-reload
sudo systemctl restart app
- Copy the NGINX config into the NGINX available sites directory and enable it:
sudo cp config/app.nginx /etc/nginx/sites-available/
ln -s /etc/nginx/sites-available/app.nginx /etc/nginx/sites-enabled/
- Verify the NGINX config is valid and then restart NGINX:
nginx -t
sudo systemctl restart nginx