ruk·si

🐍 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.
cd
ssh-keygen -t rsa
cat .ssh/id_rsa.pub                   # 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 manage.py dbshell              # Check the DB configuration
python manage.py createsuperuser      # Create super user for the Django app
python manage.py migrate
python manage.py runserver

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