OriginalLink:
http://decoding.wordpress.com/2012/01/23/how-to-setup-django-and-mysql-python-on-mac-os-x-lion/
Django is an excellent web-framework written in Python.
Here is a quick setup guide for installing Django and MySQL-python on Mac OS X Lion.
Setup Django
- Download latest Django here
- At this point I am assuming that you are familiar with the Terminal, so simply execute the following commands on your Downloads folder:
tar -xzvf Django-1.3.1.tar.gz
cd Django-1.3.1
sudo python setup.py install
Test Django installation
Type on the Terminal:
python
import django
print django.get_version()
Setup MySQL-python package
Download the latest MySQL (64-bit, tar archive) here
- Extract tar contents
- Rename folder to “mysql”
- Copy folder to /usr/local/
- You should now have mysql installed on /usr/local/mysql
Download the latest MySQL-python package here
Type on the Terminal:
tar -xvzf MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
Edit site.cfg on your favorite text editor and change the mysql path as below: mysql_config = /usr/local/mysql/bin/mysql_config
You are now ready to build and install MySQL-python:
sudo python setup.py build
sudo python setup.py install
Edit your ~/.bash_profile, add the following line:
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
If you are already using MAMP you still have to follow the above MySQL installation process, as MAMP by default doesn’t include the required header files to build MySQL-python.
Moreover if you prefer MAMP, you don’t have to run mysql from /usr/local/mysql.
On your settings.py remember to set “127.0.0.1″ as your preferred db host in case that “localhost” doesn’t work.
Test MySQL-python installation
Restart Terminal and type:
python
import MySQLdb
If you are not getting any errors at this point, then you are all good to go!
I’d suggest starting from the Django’s excellent introductory tutorial.
分享到:
相关推荐
django,liunx下mysql数据库接口MySQL-python-1.2.3.tar.gz
python MySQL-python模块 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb. Did you install mysqlclient or MySQL-python?
django-python3-ldap, python 3的Django LDAP用户身份验证后端 django-python3-ldapdjango-python3-ldap 为 python 2和 3提供了一个 Django LDAP用户身份验证后端。特性使用LDAP服务器验证用户身份。将LDAP用户与...
1、基于Django+Django -Rest-Framework+Python的在线考试系统后端(源码).zip 2、该资源包括项目的全部源码,下载可以直接使用! 3、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目...
Beginning-Django-Web-Application-Development-and-Deployment-with-Python.pdf
python-flask-and-django-full-stack-python-for-web-development
Python在线考试系统-大学毕业设计-基于Django+Django -Rest-Framework
基于Django+Django -Rest-Framework+Python的在线考试系统后端(开发源码).zip基于Django+Django -Rest-Framework+Python的在线考试系统后端(开发源码).zip基于Django+Django -Rest-Framework+Python的在线考试...
资源分类:Python库 所属语言:Python 资源全名:Django-3.2.11-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Python在线考试系统后端-大学毕业设计-基于Django+Django -Rest-Framework 适合大学生计算机专业的毕业设计,课程设计。 Python在线考试系统后端-大学毕业设计-基于Django+Django -Rest-Framework 适合大学生...
django-erp为python 3.6 以及 django 2.1.2 做的适配后项目,学习用途,新测可用。
资源分类:Python库 所属语言:Python 使用前提:需要解压 资源全名:django_flags-4.2.1-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源来自pypi官网。 资源全名:django-mysql-1.1.0.tar.gz
python库。 资源全名:django-mysql-s3-backuper-0.0.11.tar.gz
python库。 资源全名:django-mysql-2.2.2.tar.gz
资源分类:Python库 所属语言:Python 资源全名:django-admin-volt-0.0.5.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
毕业设计 系统基于协同过滤, 基于用户的和基于item的都有...基于django2+python3.7+mysql/sqlite+bootstrap3 movielens数据集 邮箱:fjl2401@163.com 详细的技术文档和readme很全。里面附带论文和数据库文件以及爬虫
python库。 资源全名:django-python-interpreter-0.0.1.tar.gz
python MySQL-python模块 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb. Did you install mysqlclient or MySQL-python
资源分类:Python库 所属语言:Python 资源全名:django-cascading-dropdown-widget-0.2.6.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059