Python+django+mysql Study Notes

Source: Internet
Author: User

Install Python

1. Download the latest version of Python from http://www.python.org/download/(I'm using python2.72, the most stable at the time)

2. Next, install to the directory you want

3. Then change path, click Advanced environment variable, Control Panel, System. Click the variable called path in the system variables form, and edit the variable to "; C:\Python27; c;\python27\scripts; "added to the end of it. Of course, it is the correct path for Python to be located.

Installing Django

1. Download the latest Django version from https://www.djangoproject.com/download/(I use the django1.3)

2. Unzip to the path you want

3. Locate setup.py and Cmd–python setup.py install

4. Installation is successful without errors

Example One

1. Create a new directory

2. Then run django-admin.py startproject mysite (MySite is your website name)

3. Then you will find the MySite directory, enter this directory, run manage.py runserver

4. Open the browser and visit http://127.0.0.1:8000/

5. See Welcome to Django Rep success!

Install Mysql-python-1.2.3.win32-py2.7.exe (python-to-MySQL interface program)

1. http://www.lfd.uci.edu/~gohlke/pythonlibs/Download the file

2. Next complete, it will find the directory of your Python

3. Open cmd. Enter Python to start Python, and then enter import _mysql, import MySQLdb

4. Installation is successful without errors

Ps:python All expansion packs, can go to http://www.lfd.uci.edu/~gohlke/pythonlibs/, there are ready-made plugins can be downloaded

Install MySQL

1. Install MySQL

    • Wamp can be downloaded. A compact package that comes with a variety of tools such as MySQL and Php,apache is installed directly. (I'm using WAMPSERVER2.1.)

2. Build a database in MySQL named MySite

3. Back to the directory of example one, open the settings.py file to modify the database settings,

Database_engine = ' MySQL '

database_name = ' MySite ' #你刚建立的数据库名字

Database_user = ' root '

Database_password = "

Database_host = "

Database_port = ' 3306′

Check:

1. Run manage.py in the directory of example one SYNCDB

2. If you find that you are starting to create a table, the database connection is OK.

3. Enter Yes. Will let you create a super administrator, enter the user name password, mailbox

4. So far, our initial Django environment has been set up, you can try to do their own small site.

Install Editor

1. http://www.jetbrains.com/pycharm/download and install the latest pycharm (I use 1.5.3, feel slow, the interface is a bit ugly)

Username:caisong.com

Registration code:

===== LICENSE BEGIN =====

90689-12042010

00003l7zwgxevo9em24bbmek8h21j8

Blcmgdbv0o5qgjfbfvhagexifdm5rh

Cetjs4wlzsdbafl6yxh6zwejkno3pw

===== LICENSE END =====

Note: Since Django's own services can not be very well applied in large-scale production environment, so we also need to build Apache, more complex, many of the Apache plug-ins only support to python2.5, still in the study, please wait ~

Python+django+mysql Study Notes

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.