eclipse django mysql数据库_Eclipse + Pydev + Django + Mysql 环境搭建

注:需要配置目录的地方请不要直接使用例子中的目录,根据自己的实际目录进行配置。

下载:python-2.7.12.amd64.msi  下载地址:http://www.python.org/

下载之后直接安装,安装之后进行环境变量的配置。配置如下:

PYTHON_HOME=D:\yingyong\Python27

Path变量中增加:%PYTHON_HOME%;%PYTHON_HOME%\Scripts;

2 安装django

下载:Django-1.10.4.tar.gz 下载地址:https://www.djangoproject.com/download/

下载之后解压。例子解药到D:\Django-1.10.4

运行-->cmd-->到django的解压目录D:\Django-1.10.4(有setup.py的目录)

-->执行命令python setup.py build和python setup.py install

-->添加D:\yingyong\Python27\Lib\site-packages\django\bin到系统环境变量path里面

3 安装Pydev

Help->Install New Software....如图:

1885568

1885568

1358928609_2057.jpg

Name随便输入个名字

Location输入:http://pydev.org/updates

点击OK,然后照着提示下载安装即可.

4 安装MySQL-python-...exe

下载:MySQL-python-...exe下载地址:http://pypi.python.org/simple/MySQL-python/    例子使用:MySQL-python-1.2.4b4.win32-py2.7.exe

下载之后直接点击exe文件进行安装即可,如果安装时出现以下错误:

python version 2.7 required,which was not found in the registry

安装PIL-1.1.7.win32-py2.7的时候,不能再注册表中识别出来python2.7

方法:新建一个register.py 文件,把一下代码贴进去,保存

#

# script to register Python 2.0 or later for use with win32all# and other extensions that require Python registry settings#

# written by Joakim Loew for Secret Labs AB / PythonWare#

# source:# http://www.pythonware.com/products/works/articles/regpy20.htm#

# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html

import sys

from _winreg import *

# tweak as necessaryversion = sys.version[:3]

installpath = sys.prefix

regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)

installkey = "InstallPath"pythonkey = "PythonPath"pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (

installpath, installpath, installpath

)

def RegisterPy():    try:

reg = OpenKey(HKEY_CURRENT_USER, regpath)    except EnvironmentError as e:        try:

reg = CreateKey(HKEY_CURRENT_USER, regpath)

SetValue(reg, installkey, REG_SZ, installpath)

SetValue(reg, pythonkey, REG_SZ, pythonpath)

CloseKey(reg)        except:            print "*** Unable to register!"

return

print "--- Python", version, "is now registered!"

return

if (QueryValue(reg, installkey) == installpath and

QueryValue(reg, pythonkey) == pythonpath):

CloseKey(reg)        print "=== Python", version, "is already registered!"

return

CloseKey(reg)    print "*** Unable to register!"

print "*** You probably have another Python installation!"

if __name__ == "__main__":

RegisterPy()

进入到存放该文件的目录,执行python register.py即可。

显示“python 2.7 is already registered”

再安装setuptools的时候,就能自动识别出来python2.7了。

win7是 64的原因,在安装python(32位)时,如果选择只为当前用户,以上问题是不会出现的,如果选择所有用户,那就用上面的方法解决吧。

5 eclipse配置

Preferences->Pydev->Interpreter-Python点Auto Config 如图:

1358929249_2790.jpg

2 2

Auto  Config之后如图:

1358929326_8641.jpg

点击ok完成配置

6 创建django项目

打开eclipse->File->New->other出现如图:

1358929526_7567.jpg

选择创建django项目然后Next

1358929647_2508.jpg

一直Next到下面界面:

1358929733_4574.jpg

当然你也可以选择其他数据库

注:选择其他数据需安装对应的如MySQL-python-1.2.4b4.win32-py2.7.exe这样的文件

点击finish完成django项目的创建。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值