如何让PostgresSQL在带有django的Windows 7电脑上工作? [英] How to get postgresSQL to work on a windows 7 computer with django?
问题描述
我正在阅读 django book ,他们的说明不正常为了我。人们正在谈论编辑他们的路径,并在评论中需要充分的路径,我真的不知道他们在说什么是诚实的。我得到django安装正确,但我不能为我的生活形象。对人们的评论的任何建议或解释将不胜感激。
I'm currently reading the django book and their instructions aren't working for me. People are talking about editing their paths and needing full paths in the comments and I really just have no idea what they are talking about to be honest. I got django to install correctly but I can't for the life of me figure this out. Any suggestions or explanations of peoples comment would be greatly appreciated.
推荐答案
在做任何事情之前,请确保您有 C:\Python27\Scripts
添加到您的 PATH
中,这是大多数软件包安装其脚本的地方(如django-admin.py)。
Before you do anything, make sure that you have C:\Python27\Scripts
added to your PATH
, this is where most packages install their scripts (such as django-admin.py).
将 C:\Python27
替换为系统中安装Python的位置
Replace C:\Python27
with wherever Python is installed in your system
一旦你这样做,打开一个新的命令提示符,所以系统将读取 PATH
。
Once you have done that, open a new command prompt so the system will read the PATH
.
C:\> python django-admin.py startproject myproject
应该没有任何问题。
接下来,安装postgresql。最简单的方法是使用一键安装程序。
Next, install postgresql. The easiest way is to use the one click installer.
最后,下载适用于Windows的 pyscopg库。确保您选择与您的Python版本相对应的。
Finally, download the pyscopg library for Windows. Make sure you pick the one that corresponds with your version of Python.
现在,您可以通过在postgresql中创建数据库来继续。使用pgadmin工具(称为 pgadmin III
)。
Now you can continue by creating a database in postgresql. Use the pgadmin tool (called pgadmin III
).
- 展开
服务器
在左窗格下的服务器组
下 - 双击列出的服务器(应为
PostgreSQL 9.0(localhost:5432)
)。这将连接到服务器。您需要使用安装程序中设置的密码。 - 右键单击
登录角色
,然后选择新角色
- 填写
角色名称
(这是用户的登录名) - 输入两个密码。
- 单击确定。
- 右键单击
/ code>,并选择
新数据库..
- 给它一个名字
- 在
所有者
字段中,在步骤4中输入您在角色名称
中输入的名称。 - 单击确定
- Expand the
Servers
tree underServer Groups
on the left pane. - Double click on the server listed (should be
PostgreSQL 9.0 (localhost:5432)
). This connects you to the server. You need to use the password you set up in the installer. - Right click on
Login Roles
, and selectNew Role..
- Fill in the
Role name
(this is the user's login name) - Enter two passwords.
- Click OK.
- Right click on
Databases
, and selectNew Database..
- Give it a name
- In the
Owner
field, enter the name you entered inRole name
in step 4. - Click OK
从这里开始,您可以按照教程中的说明进行操作。
From here on, you can follow the instructions in the tutorial.
这篇关于如何让PostgresSQL在带有django的Windows 7电脑上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!