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/20 19:29] ninindeployment_raspberry [2025/11/27 22:39] (current) ninin
Line 9: Line 9:
 Virtual environment Virtual environment
     cd sese_project/serious-seeds     cd sese_project/serious-seeds
 +    python3 -m venv env
     source env/bin/activate     source env/bin/activate
 +    pip install -r app/requirements.txt
  
-Create Database +Set Environment Variables 
 +    export DJANGO_ENV=production 
 +    export POSTGRES_DB=<db> 
 +    export POSTGRES_USER=<user> 
 +    export POSTGRES_PASSWORD=<pw>
  
 Start Dev Server Start Dev Server
Line 64: Line 69:
   python manage.py collectstatic   python manage.py collectstatic
  
 +With cleanup:
 +  python manage.py collectstatic --noinput --clear
  
 === Nginx === === Nginx ===
Line 75: Line 82:
   sudo nginx -t   sudo nginx -t
   sudo systemctl restart nginx   sudo systemctl restart nginx
 +
 +Analyse:
 +
 +  sudo nginx -T | sed -n '1,200p' | grep -n 'proxy_pass\|upstream'
  
  
Line 80: Line 91:
  
   sudo nano /etc/systemd/system/gunicorn.service   sudo nano /etc/systemd/system/gunicorn.service
-  sudo systemctl start gunicorn.service+ 
 +Bei Änderungen: 
 + 
 +  systemctl daemon-reload 
 +  sudo systemctl restart gunicorn 
 +   
 +followed by a hard browser refresh (Ctrl + Shift + R). 
 + 
 + 
 +=== Rollout Release === 
 + 
 +# In deinem Produktionsverzeichnis 
 +  cd /pfad/zu/serious-seeds 
 + 
 +# Aktiviere Virtual Environment 
 +  source env/bin/activate 
 + 
 +# Hole neueste Tags 
 +  git fetch --tags 
 + 
 +# Liste verfügbare Tags auf 
 +  git tag -l 
 + 
 +# Checke das gewünschte Tag aus (mit lokalem Branch, um keinen detached-head zu bekommen) 
 +  git checkout -b production-v1.0.0 tags/v1.0.0 
 + 
 +# Installiere/Update Dependencies 
 +  pip install -r app/requirements.txt 
 + 
 +# Führe Migrations aus (falls nötig) 
 +  python app/manage.py migrate 
 + 
 +# Sammle Static Files 
 +  python app/manage.py collectstatic --noinput 
 + 
 +# Starte Gunicorn neu 
 +  sudo systemctl restart gunicorn 
  
 === Tutorial === === Tutorial ===
Line 86: Line 134:
 https://www.teachmemicro.com/building-a-django-webserver-on-raspberry-pi-a-step-by-step-guide/ 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.1760988562.txt.gz · Last modified: by ninin