MAC (mountain lion) + eclipse + Python + djgano + pydve + MySQL Development Environment setup

Source: Internet
Author: User
Tags django server django website install django

Installing the eclipse + Python + djgano + pydve development environment on the Mac platform is complicated. It took me a lot of time to install it successfully!

The main difficulties are:

(1) The installation path of Multi-version software may change, so that the software cannot quickly find the path of the latest version you have installed, if the eclipse you installed does not find the python path you installed

You need to manually add the python intrepreter path. This time, the python installation path is/usr/local/bin/pythonw. Therefore, eclipse always finds the correct path at the beginning, leading to compilation errors!

(2) The installation of MySQL is laborious. In addition to the two installation packages officially provided, the installation of Python-mysqldb requires errors!


0. Install JDK


Go to the JDK Official Website.

Mountain lion is a 64-bit operating system, so all of the following software should select the 64-bit installation package!

 

1. Install Python and DJANGO:

Python 1.1

Python has been installed on Mac. You can upgrade it to the latest stable version. This time, I used python2.7.

:Http://www.python.org/

1.2 Django (
Http://www.djangoproject.com /)

Django's:Http://www.djangoproject.com/download/

Decompress the package to the directory where the file is located and execute:

Python setup. py install

Install Django

 

It is easy to test whether Django is successfully installed. Enter the python editing environment,

Input: Import Django

Enter Django. version.

If the version number is displayed correctly, the operation is successful.

 

2. Install eclipse


Download and decompress eclipse and run Eclipse:


Use eclipse-> Windows-> preferences-> install/update-> available software sites to add the pydev website, and install pydev through eclipse-> help-> install new software...


Pydev Eclipse: http://pydev.org/updates/


Configure pydev,Preferences-> pydev-> interpreter-PythonClick auto configCreate a python project: file-> New-> other...-> pydev project,



Test and development environment: Right-click SRC and choose new> pydev module>...Input print ('hello') in hello. py. F9 runs successfully.


Open eclipse, select window-> preferences-> pydev-> interpreter-Python, and select new in the "Python interpreters" Panel on the right,


In the pop-up dialog box, set "interpreter name" to "Python", locate the python address in "interpreter executable", and select "OK" all the time:



3. Install the MySQL database:

MySQL: http://www.mysql.com/downloads/mysql/

Mysqlworkbench: http://cdn.mysql.com/Downloads/MySQLGUITools/mysql-workbench-gpl-5.2.47-osx-i686.dmg

4.Install eclipseDevelopment in progressPythonPlug-insPydev

5. Install Python-mysqldb

Download mysql-python-1.2.3.tar: http://jaist.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.tar.gz

Decompress the package and go to the mysql-Python directory to modify the rows in the file SITE. cfg.

# Mysql_config =/usr/local/bin/mysql_config

Remove comments

Change to mysql_config =/usr/local/bin/mysql_config

You can try to execute

 

# Python setup. py build

# Python setup. py install

Install! If the installation fails:

Use xcode to install command line tool to install the GCC compilation tool;

: Http://adcdownload.apple.com/Developer_Tools/command_line_tools_ OS _x_mountain_lion_for_xcode__april_2013/xcode462_cltools_10_86938259a.dmg

After installation is complete! Run the following command in the mysql-Python directory:

 

# Python setup. py build

# Python setup. py install

If the execution is successful, no error is reported! You can execute Python

Import mysqldb and try to check whether the installation is successful!

 

# Python

>>> Import mysqldb

5. Create a Django website project to connect to MySQL:


Create Django Website: file-> New-> other...-> pydev Django project, run as Django, and then open http: // 127.0.0.1: 8000 /.

Copy: http: // 127.0.0.1: 8000/open in the browser:

 

Common manage. py commands:

Django-admin.py startproject mysite: new project.

Manage. py runserver IP port: Start the built-in Django server.

Manage. py shell: Start the Django background shell.

Manage. py Startapp appname: Create an app.

Manage. py validate: Check whether the model is correct.

Manage. py sqlall appname: generate the create table statement.

Manage. py syncdb: generate a table for the model.

Androidapp programmer:230669335


IOS appprogrammer:251398599

Python programmer:272179490

Recommended PythonLearningNetworkAddress: http://djangobook.py3k.cn/2.0/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.