IP ermitteln:
arp -a
login:
ssh user@ip
Virtual environment
cd sese_project/serious-seeds python3 -m venv env source env/bin/activate pip install -r app/requirements.txt
Set Environment Variables
export DJANGO_ENV=production export POSTGRES_DB=<db> export POSTGRES_USER=<user> export POSTGRES_PASSWORD=<pw>
Start Dev Server
python3 manage.py runserver 0.0.0.0:8000
Create a new systemd service file:
sudo systemctl edit –force –full wifipower.service
Paste the following content into the file:
Code
[Unit] Description=Disable WiFi Power Management [Service] Type=oneshot RemainAfterExit=yes ExecStart=/sbin/iw dev wlan0 set power_save off [Install] WantedBy=multi-user.target
Save and exit the editor.
Enable the service:
sudo systemctl enable wifipower.service.
Start the service immediately:
sudo systemctl start wifipower.service
or reboot the Pi for it to take effect:
sudo reboot
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>;
- Static Files
python manage.py collectstatic
With cleanup:
python manage.py collectstatic --noinput --clear
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
Analyse:
sudo nginx -T | sed -n '1,200p' | grep -n 'proxy_pass\|upstream'
sudo nano /etc/systemd/system/gunicorn.service
Bei Änderungen:
systemctl daemon-reload sudo systemctl restart gunicorn
followed by a hard browser refresh (Ctrl + Shift + R).
# 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