我也在我的Mac上做Django开发,但已经找到了一个更好的解决方案(它允许使用pip)来使用Vagrant + VirtualBox + Chef在本地VM中安装Django(这将允许您复制生产服务器设置)。然后您可以在本地浏览器上访问它。有一个很好的介绍在这里:
http://blog.smalleycreative.com/tutorials/setup-a-django-vm-with-vagrant-virtualbox-and-chef/
我已经更新到本教程提供使用precise32(留在人谁可能是在32位系统兼容),一个新的Ubuntu发行版的vagrantfile,并包括emacs,python和MySQL客户端。我希望这有帮助。必要
其他的git回购协议:
git clone git://github.com/opscode-cookbooks/emacs
git clone git://github.com/opscode-cookbooks/python
git clone git://github.com/opscode-cookbooks/mysql
而且Vagrantfile:
Vagrant::Config.run do |config|
config.vm.define :djangovm do |django_config|
# Every Vagrant virtual environment requires a box to build off of.
django_config.vm.box = "precise32"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
django_config.vm.box_url = "http://files.vagrantup.com/precise32.box"
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
django_config.vm.forward_port 80, 8080
django_config.vm.forward_port 8000, 8001
# Enable provisioning with chef solo, specifying a cookbooks path (relative
# to this Vagrantfile), and adding some recipes and/or roles.
#
django_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apt"
chef.add_recipe "apache2::mod_wsgi"
chef.add_recipe "build-essential"
chef.add_recipe "git"
chef.add_recipe "vim"
chef.add_recipe "emacs"
chef.add_recipe "python"
chef.add_recipe "mysql"
#
# # You may also specify custom JSON attributes:
# chef.json = { :mysql_password => "foo" }
end
end
end
感谢您的提示。现在我只是得到一个错误,因为我已经安装了一个pip版本:Error:org.macports.activate for port py27-pip returned:Image error:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/ bin/pip已经存在,并且不属于注册的端口。无法激活端口py27-pip。使用'port -f activate py27-pip'强制激活。在Linux上,我通常会执行sudo apt-get purge pip(或类似操作),但是如何在OSX上卸载现有的pip? – kramer65 2013-05-15 02:58:22
不幸的是,你没有通过macports安装它,因此'不属于注册的端口'只是强制激活它将覆盖它 – Mark 2013-05-15 09:59:36
不幸的是,这仍然不起作用。我做了'sudo port -f install py27-pip',然后'sudo pip install web.py'再次导致“Requirement already satisfied”,而在Python交互式命令行中导入web仍然给我一个“ImportError:No模块名为web“。任何其他想法? – kramer65 2013-05-15 15:05:21