在另一台计算机上运行django vagrant项目时出现问题

时间:2019-10-12 13:57:22

标签: python django vagrant virtual-machine

我买了新笔记本电脑,想在新机器上运行桌面项目,

我在项目上运行了“ git clone”: https://github.com/MateuszKijewski/to-do-api 然后克隆后,我运行了“ vagrant up”和“ vagrant ssh”

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://vagrantcloud.com/search.
  config.vm.box = "ubuntu/bionic64"
  config.vm.box_version = "~> 20190314.0.0"

  config.vm.network "forwarded_port", guest: 8000, host: 8000

  config.vm.provision "shell", inline: <<-SHELL
    systemctl disable apt-daily.service
    systemctl disable apt-daily.timer

    sudo apt-get update
    sudo apt-get install -y python3-venv zip
    touch /home/vagrant/.bash_aliases
    if ! grep -q PYTHON_ALIAS_ADDED /home/vagrant/.bash_aliases; then
      echo "# PYTHON_ALIAS_ADDED" >> /home/vagrant/.bash_aliases
      echo "alias python='python3'" >> /home/vagrant/.bash_aliases
    fi
  SHELL
 end

起初我以为它可以正常工作,但是后来我看到我无法运行“ pip”,也无法启用虚拟环境。我认为我不应该手动安装它们

我非常感谢您提供帮助,希望能在新笔记本电脑上进行编码;)

0 个答案:

没有答案