createdb错误:在django中创建和同步数据库(windows7)

时间:2015-12-17 17:27:21

标签: django postgresql

我遵循教程 https://code.google.com/p/geodjango-basic-apps/wiki/FOSS4GWorkshop

当我创建同步数据库时我得到了错误

water.api.FSIOException

我的postgres在端口5433上运行,我在postgresql.conf中进行了必要的更改。我已经设置了

    createdb error: could not connect to database template1: could not connect to server:Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting 
TCP/IP connections on port 5432? received invalid response to SSL negotiation: -

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

这可能不是你要找的答案。 我一直在windows机器上遇到各种问题,这就是为什么我切换到ubuntu的原因。 但是,当我想用​​它与Windows时,我最终使用Vagrant,效果非常好并且非常容易安装(如果你使用pycharm,你甚至有一个向导用于设置它与vagrant;调试器工作完美无瑕)。 这就是我provisioning.sh的样子。只需将其放在项目的根目录中,安装vagrant并调用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  -----

希望有所帮助!