User Tools

Site Tools


deployment_raspberry

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
deployment_raspberry [2025/10/15 18:53] ninindeployment_raspberry [2025/10/20 19:50] (current) ninin
Line 1: Line 1:
-ip ermitteln:+=== Allgemein ===
  
-login: ssh user@ip+IP ermitteln: 
 +  arp -a 
 + 
 +login: 
 +  ssh user@ip
  
 Virtual environment Virtual environment
-cd sese_project/serious-seeds +    cd sese_project/serious-seeds 
-source env/bin/activate+    source env/bin/activate
  
 Create Database Create Database
Line 11: Line 15:
  
 Start Dev Server Start Dev Server
-python3 manage.py runserver 0.0.0.0:8000+      python3 manage.py runserver 0.0.0.0:8000
  
  
-### Turn off power management for network adapter+=== Turn off power management for network adapter ===
  
 Create a new systemd service file: Create a new systemd service file:
Line 26: Line 30:
     [Unit]     [Unit]
     Description=Disable WiFi Power Management     Description=Disable WiFi Power Management
- 
     [Service]     [Service]
     Type=oneshot     Type=oneshot
     RemainAfterExit=yes     RemainAfterExit=yes
     ExecStart=/sbin/iw dev wlan0 set power_save off     ExecStart=/sbin/iw dev wlan0 set power_save off
- 
     [Install]     [Install]
     WantedBy=multi-user.target     WantedBy=multi-user.target
  
-    Save and exit the editor. +Save and exit the editor. 
  
 Enable the service: Enable the service:
-sudo systemctl enable wifipower.service. +    sudo systemctl enable wifipower.service. 
  
 Start the service immediately: Start the service immediately:
-sudo systemctl start wifipower.service+    sudo systemctl start wifipower.service 
 + 
 +or reboot the Pi for it to take effect: 
 +    sudo reboot 
 + 
 +=== Create Database === 
 + 
 +  sudo su postgres 
 +  psql 
 +  CREATE DATABASE <db>; 
 +  CREATE USER <user>; 
 +  ALTER USER <user> with encrypted password '<pw>'; 
 +  GRANT ALL PRIVILEGES ON DATABASE <db> TO <user>; 
 +  ALTER DATABASE <db> OWNER TO <user>; 
 + 
 + 
 +=== Deployment Checklist === 
 + 
 +- Static Files 
 +  python manage.py collectstatic 
 + 
 + 
 +=== Nginx === 
 + 
 +  sudo nano /etc/nginx/sites-available/seriousseeds 
 + 
 +Next, enable the configuration: 
 + 
 +  sudo ln -s /etc/nginx/sites-available/seriousseeds /etc/nginx/sites-enabled/ 
 + 
 +  sudo nginx -t 
 +  sudo systemctl restart nginx 
 + 
 + 
 +=== Gunicorn ===
  
-(or reboot the Pi for it to take effect.)+  sudo nano /etc/systemd/system/gunicorn.service 
 +  sudo systemctl start gunicorn.service
  
 +=== Tutorial ===
  
 +https://www.teachmemicro.com/building-a-django-webserver-on-raspberry-pi-a-step-by-step-guide/
 +https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu#installing-the-packages-from-the-ubuntu-repositories
deployment_raspberry.1760554413.txt.gz · Last modified: by ninin