如何使用 django 让 postgresSQL 在 Windows 7 计算机上工作?
我目前正在阅读 django 书,他们的说明对我不起作用。人们正在谈论编辑他们的路径并需要在评论中提供完整路径,说实话我真的不知道他们在说什么。我让 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在执行任何操作之前,请确保已将
C:\Python27\Scripts
添加到您的PATH
中,这是大多数包安装其脚本的位置(例如 django-admin.js)。 py)。将
C:\Python27
替换为系统中安装 Python 的位置完成此操作后,打开一个新的命令提示符,以便系统将读取
路径
。C:\>python django-admin.py startproject myproject
应该可以正常工作。
接下来,安装 postgresql。最简单的方法是使用一键安装程序。
最后,下载适用于 Windows 的 pyscopg 库。确保您选择与您的 Python 版本相对应的版本。
现在您可以继续在 postgresql 中创建数据库。使用 pgadmin 工具(称为 pgadmin III)。
服务器组
下的服务器
树。Login Roles
,选择New Role..
Role name
(这是用户的登录名)Databases
,然后选择New Database..
Owner
字段中,输入您在中输入的名称步骤 4 中的角色名称
。从这里开始,您可以按照教程中的说明进行操作。
Before you do anything, make sure that you have
C:\Python27\Scripts
added to yourPATH
, this is where most packages install their scripts (such as django-admin.py).Replace
C:\Python27
with wherever Python is installed in your systemOnce you have done that, open a new command prompt so the system will read the
PATH
.C:\>python django-admin.py startproject myproject
Should work without any problems.
Next, install postgresql. The easiest way is to use the one click installer.
Finally, download the pyscopg library for Windows. Make sure you pick the one that corresponds with your version of Python.
Now you can continue by creating a database in postgresql. Use the pgadmin tool (called
pgadmin III
).Servers
tree underServer Groups
on the left pane.PostgreSQL 9.0 (localhost:5432)
). This connects you to the server. You need to use the password you set up in the installer.Login Roles
, and selectNew Role..
Role name
(this is the user's login name)Databases
, and selectNew Database..
Owner
field, enter the name you entered inRole name
in step 4.From here on, you can follow the instructions in the tutorial.