【发布时间】:2014-07-24 15:44:23
【问题描述】:
我正在尝试在 Google Compute Engine 上部署 Django 应用程序。我正在使用 Debian 7 映像并希望使用 Nginx、Gunicorn、virtualenv、supervisor 和 PostgreSQL 设置 Django。我的开发机器运行 Ubuntu 14.04,安装了 Django,PostgreSQL 作为后端,一切运行良好。
我正在使用位于http://datacommunitydc.org/blog/2013/12/a-tutorial-for-deploying-a-django-application-that-uses-numpy-and-scipy-to-google-compute-engine-using-apache2-and-modwsgi/ 的教程。我还在使用位于http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/ 的教程,因为它特定于我在我的开发机器上使用的 virtualenv 和 PostgreSQL。我已经设置了我的 GCE 实例,安装并更新了 aptitude。我已经安装了 PostgreSQL,但是当我尝试为应用程序创建一个数据库用户和一个新数据库时,我收到一个错误,并且没有创建任何内容。
按照我运行的教程:
$ sudo su - postgres
postgres@django:~$ createuser -P
Enter name of role to add: hello_django
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
当它尝试创建新用户角色时,我收到以下错误:
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
当我运行 shell 脚本 ls /etc/init.d 时,它说 postgresql 正在运行,但我仍然无法添加新角色。谁能告诉我我做错了什么?
问候。
【问题讨论】:
-
你找到解决方案了吗,因为我和你有同样的问题。
标签: django postgresql debian google-compute-engine