這可能不是您正在尋找的答案。 我一直有一個Windows機器上的Postgre的各種問題,這就是爲什麼我切換到Ubuntu的原因。 但是,當我想用它與Windows時,我最終使用Vagrant其中工作得很好,並且很容易安裝(如果您使用pycharm,甚至有一個嚮導用於設置流浪漢;調試器工作完美無瑕以及)。 這就是我的provisioning.sh
的樣子。只需把它放在你的項目的根目錄,安裝流浪漢,叫vagrant up
:
#!/usr/bin/env bash
echo "----- CONFIGURE SYSTEM -----"
echo "--- Disable IPv6 (Step 1/1)"
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo "net.ipv6.conf.all.disable_ipv6 = 1" >/etc/sysctl.d/01-disable-ipv6.conf
echo on
echo "--- SYSTEM REQUIREMENTS -----"
echo "--- APT-GET UPDATE (SYSREQ Step 1/5)"
apt-get update
echo "--- INSTALL PYTHON-PIP (SYSREQ Step 2/5)"
apt-get install -y python-pip
echo "--- INSTALL PYTHON-DEV (SYSREQ Step 3/5)"
apt-get install -y python-dev
echo "--- INSTALL LIBPQ-DEV (SYSREQ Step 4/5)"
apt-get install -y libpq-dev
echo "--- INSTALL LIBMYSQLCLIENT-DEV (SYSREQ Step 5/5)"
apt-get install -y libmysqlclient-dev
echo ----- POSTGRES -----
echo "--- INSTALL POSTGRES (POSTGRES Step 1/6)"
apt-get install -y postgresql
echo "--- INSTALL POSTGRES-CLIENT (POSTGRES Step 2/6)"
apt-get install -y postgresql-client
echo "--- START POSTGRES (POSTGRES Step 3/6)"
postgres -D /usr/local/pgsql/data >logfile 2>&1 &
echo "--- CREATE DB (POSTGRES Step 4/6)"
su -c "createdb --encoding='utf-8' --locale=en_US.utf8 --template=template0 project_name_db" postgres
echo "--- LOAD DB IMAGE (POSTGRES Step 5/6)"
su -c "psql project_name_db < /vagrant/vagrant-database/project_namedb.sql" postgres
echo "--- CREATE VAGRANT POSTGRES USERS (POSTGRES Step 6/6)"
su -c "createuser -s vagrant" postgres
su -c "createuser -s root" postgres
echo ----- GIT -----
apt-get install -y git
echo ----- RUBY -----
echo "--- INSTALL SASS (RUBY Step 1/4)"
gem install sass -v 3.2.9
echo "--- INSTALL CHUNKY_PNG (RUBY Step 2/4)"
gem install chunky_png -v 1.2.8
echo "--- INSTALL FSSM (RUBY Step 3/4)"
gem install fssm -v 0.2.10
echo "--- INSTALL COMPASS (RUBY Step 4/4)"
gem install compass -v 0.12.2
echo ----- PYTHON -----
echo "--- INSTALL REQUIREMENTS (PYTHON Step 1/1)"
pip install -r /vagrant/requirements_local.txt
echo ----- LOCALE -----
echo "--- INSTALL GERMAN LANGUAGE PACK"
apt-get install language-pack-de
echo ----- PREPARING SERVER -----
echo "--- MIGRATE (RUN SERVER Step 2/2)"
python /vagrant/manage.py migrate --settings=project_name.settomgs.settings_local_dev_vagrant
echo "Server is ready to go! Execute the following command inside the VM to run the server:"
echo "python /vagrant/manage.py runserver 0.0.0.0:8080 --settings=project_name.settings.settings_local_dev_vagrant"
echo ----- PROVISIONING FINISHED -----
希望幫助!