🐍 Python
venvs in Production

Updated at 2017-08-31 16:38

Simple example how to setup a Python venv project in production.

# Switch to the user you want to act as the application.
ssh-keygen -t rsa
cat .ssh/                   # Add the public SSH key to GitHub
git clone kappa.git
apt-get install python3
pip3 install --user virtualenv
./.local/bin/virtualenv venvs/kappa
source ./venv/bin/activate
cd kappa
pip install -r requirements.txt

# Other project related setup, e.g. for Django:
python dbshell              # Check the DB configuration
python createsuperuser      # Create super user for the Django app
python migrate
python runserver

# Then host the service like you want (supervisor, systemd, systemv)
# Remember to use separate user for that also.