I will be installing Baby Buddy manually - no Docker.
Install required system packages
apt install python3 python3-pip uwsgi uwsgi-plugin-python3 libopenjp2-7-dev libpq-dev nginx git
At this point, the author wants us to install pipenv
. The only way to install this is to use pip. In most cases, you don't want to use pip to install packages to the main OS - this could break the existing Python environment.
I'm going to create a venv to install pipenv, then run it out of there.
python3 -m venv /opt/pipenv
source /opt/pipenv/bin/activate
pip3 install pipenv
Create a new installation directory for BB
mkdir -p /var/www/babybuddy/data/media
Clone BB
git clone https://github.com/babybuddy/babybuddy.git /var/www/babybuddy/public
Move into the application directory (public
)
cd /var/www/babybuddy/public
Create and enter a Python environment
export PIPENV_VENV_IN_PROJECT=1
/opt/pipenv/bin/pipenv install three
/opt/pipenv/bin/pipenv shell
Copy the example config file to production.py
cp babybuddy/settings/production.example.py babybuddy/settings/production.py
In production.py
, set SECRET_KEY
and ALLOWED_HOSTS
SECRET_KEY = "*****************************************"
ALLOWED_HOSTS = ["127.0.0.1"]
Initialize the application
export DJANGO_SETTINGS_MODULE=babybuddy.settings.production
python manage.py migrate
Set permissions for the database and data directory
chown -R www-data:www-data /var/www/babybuddy
chmod 640 /var/www/babybuddy/data/db.sqlite3
chmod 750 /var/www/babybuddy/data
At this point, you can exit the Python venv and return to your home directory
deactivate && exit
cd
Create and configure the WSGI server
vim /etc/uwsgi/apps-available/babybuddy.ini
Example config:
[uwsgi]
plugins = python3
project = babybuddy
base_dir = /var/www/babybuddy
chdir = %(base_dir)/public
virtualenv = %(chdir)/.venv
module = %(project).wsgi:application
env = DJANGO_SETTINGS_MODULE=%(project).settings.production
master = True
vacuum = True
Enable (link) the WSGI config file to the enabled site directory, then restart the service
ln -s /etc/uwsgi/apps-available/babybuddy.ini /etc/uwsgi/apps-enabled/babybuddy.ini
systemctl restart uwsgi.service
systemctl status uwsgi.service
Configure NGINX to proxy requests to the WSGI server