use python3 from venv if manage.py gets started with 2

This commit is contained in:
j 2017-03-16 12:37:29 +01:00
parent d7f09b27d5
commit 87fe056e56
2 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,12 @@ import sys
root_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
os.chdir(root_dir)
python3 = os.path.normpath(os.path.join(root_dir, '..', 'bin', 'python3'))
if os.path.exists(python3) and sys.version_info[0] == 2 and sys.argv[0].endswith('manage.py'):
import subprocess
cmd = [python3] + sys.argv
sys.exit(subprocess.call(cmd))
# using virtualenv's activate_this.py to reorder sys.path
activate_this = os.path.join(root_dir, '..', 'bin', 'activate_this.py')
with open(activate_this) as f:

View File

@ -22,6 +22,7 @@
echo "pandora:pandora" | chpasswd
echo PasswordAuthentication no >> /etc/ssh/sshd_config
locale-gen en_US.UTF-8
export LANG=en_US.UTF-8
cd /root
curl -L https://pan.do/ra-install > pandora_install.sh