Python论坛  - 讨论区

标题:[python-chinese] Python 如何连接 MySQL

A&J

A&J

2006年10月26日 星期四 13:43

xiaoliang alabos在163.com
星期四 十月 26 13:43:03 HKT 2006

请问在 django 中,如果使用MYSQL数据库,是否需要安装其它的东西?  如何进行?

谢谢!!


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年10月26日 星期四 13:56

nmweizi nmweizi在163.com
星期四 十月 26 13:56:18 HKT 2006

python-chinese£¬ÄãºÃ

Get your database running
=========================
If you plan to use Django's database API functionality, you'll need to
make sure a database server is running. Django works with PostgreSQL_
(recommended), MySQL_ and SQLite_.
Additionally, you'll need to make sure your Python database bindings are
installed.
* If you're using PostgreSQL, you'll need the psycopg_ package (version 1.1 --
  not version 1.0 or version 2, which is still in beta). If you're on Windows,
  check out the unofficial `compiled Windows version`_.
* If you're using MySQL, you'll need MySQLdb_.
* If you're using SQLite, you'll need pysqlite_. Use version 2.0.3 or higher.
.. _PostgreSQL: http://www.postgresql.org/
.. _MySQL: http://www.mysql.com/
.. _Django's ticket system: http://code.djangoproject.com/report/1
.. _psycopg: http://initd.org/projects/psycopg1
.. _compiled Windows version: http://stickpeople.com/projects/python/win-psycopg/
.. _MySQLdb: http://sourceforge.net/projects/mysql-python
.. _SQLite: http://www.sqlite.org/
.. _pysqlite: http://initd.org/tracker/pysqlite



nmweizi£¬nmweizi在163.com
2006-10-26 
----- Original Message ----- 
From: xiaoliang 
To: python-chinese 
Sent: 2006-10-26, 13:43:03
Subject: [python-chinese] Python ÈçºÎÁ¬½Ó MySQL


ÇëÎÊÔÚ django ÖÐ,Èç¹ûʹÓÃMYSQLÊý¾Ý¿â,ÊÇ·ñÐèÒª°²×°ÆäËüµÄ¶«Î÷? ÈçºÎ½øÐÐ?

лл!!

_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20061026/64d423b7/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年10月26日 星期四 14:05

nmweizi nmweizi在163.com
星期四 十月 26 14:05:48 HKT 2006

nmweizi,python-chinese£¬ÄãºÃ
½Ó×ÅÔÚsetting.pyÖÐÅäÖÃÏÂÃæµÄ²ÎÊý¼´¿É

DATABASE_ENGINE
---------------
Default: ``'postgresql'``
Which database backend to use. Either ``'postgresql'``, ``'mysql'``,
``'sqlite3'`` or ``'ado_mssql'``.
DATABASE_HOST
-------------
Default: ``''`` (Empty string)
Which host to use when connecting to the database. An empty string means
localhost. Not used with SQLite.
If this value starts with a forward slash (``'/'``) and you're using MySQL,
MySQL will connect via a Unix socket to the specified socket. For example::
    DATABASE_HOST = '/var/run/mysql'
If you're using MySQL and this value *doesn't* start with a forward slash, then
this value is assumed to be the host.
DATABASE_NAME
-------------
Default: ``''`` (Empty string)
The name of the database to use. For SQLite, it's the full path to the database
file.
DATABASE_PASSWORD
-----------------
Default: ``''`` (Empty string)
The password to use when connecting to the database. Not used with SQLite.
DATABASE_PORT
-------------
Default: ``''`` (Empty string)
The port to use when connecting to the database. An empty string means the
default port. Not used with SQLite.
DATABASE_USER
-------------
Default: ``''`` (Empty string)
The username to use when connecting to the database. Not used with SQLite.
DATE_FORMAT
-----------
Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
The default formatting to use for date fields on Django admin change-list
pages -- and, possibly, by other parts of the system. See
`allowed date format strings`_.
See also DATETIME_FORMAT, TIME_FORMAT, YEAR_MONTH_FORMAT and MONTH_DAY_FORMAT.
.. _allowed date format strings: http://www.djangoproject.com/documentation/templates/#now
DATETIME_FORMAT
---------------
Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
The default formatting to use for datetime fields on Django admin change-list
pages -- and, possibly, by other parts of the system. See
`allowed date format strings`_.
See also DATE_FORMAT, DATETIME_FORMAT, TIME_FORMAT, YEAR_MONTH_FORMAT and MONTH_DAY_FORMAT.
.. _allowed date format strings: http://www.djangoproject.com/documentation/templates/#now


nmweizi£¬nmweizi在163.com
2006-10-26 
----- Original Message ----- 
From: nmweizi 
To: python-chinese 
Sent: 2006-10-26, 13:56:18
Subject: Re: [python-chinese] Python ÈçºÎÁ¬½Ó MySQL


python-chinese£¬ÄãºÃ

Get your database running
=========================
If you plan to use Django's database API functionality, you'll need to
make sure a database server is running. Django works with PostgreSQL_
(recommended), MySQL_ and SQLite_.
Additionally, you'll need to make sure your Python database bindings are
installed.
* If you're using PostgreSQL, you'll need the psycopg_ package (version 1.1 --
  not version 1.0 or version 2, which is still in beta). If you're on Windows,
  check out the unofficial `compiled Windows version`_.
* If you're using MySQL, you'll need MySQLdb_.
* If you're using SQLite, you'll need pysqlite_. Use version 2.0.3 or higher.
.. _PostgreSQL: http://www.postgresql.org/
.. _MySQL: http://www.mysql.com/
.. _Django's ticket system: http://code.djangoproject.com/report/1
.. _psycopg: http://initd.org/projects/psycopg1
.. _compiled Windows version: http://stickpeople.com/projects/python/win-psycopg/
.. _MySQLdb: http://sourceforge.net/projects/mysql-python
.. _SQLite: http://www.sqlite.org/
.. _pysqlite: http://initd.org/tracker/pysqlite



nmweizi£¬nmweizi在163.com
2006-10-26 
----- Original Message ----- 
From: xiaoliang 
To: python-chinese 
Sent: 2006-10-26, 13:43:03
Subject: [python-chinese] Python ÈçºÎÁ¬½Ó MySQL


ÇëÎÊÔÚ django ÖÐ,Èç¹ûʹÓÃMYSQLÊý¾Ý¿â,ÊÇ·ñÐèÒª°²×°ÆäËüµÄ¶«Î÷? ÈçºÎ½øÐÐ?

лл!!

_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20061026/41fccb87/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号