Chapter 2 Introduction

Source: Internet
Author: User
Tags subversion client install django version control system
Python Installation Install Python + pyqt + Eric on Windows. For more information, see install Python + pyqt + Eric on Linux or Mac OS X. Http://www.python.org/download/ Django Installation Official release version installation

Most people will consider downloading the latest official release from the http://www.djangoproject.com/download. Django uses the python StandardDistutilsThe installation method may include the following steps on the Linux platform:

 

    1. Download the tar installation package. The file name may beDjango-0.96.tar.gz.

       

    1. Tar Xzvf Django-* .tar.gz.

       

    1. CD Django -*.

       

    1. Sudo Python Setup. py Install.

       

On Windows, we recommend that you use7-zipTo process compressed files in various formats, including the. tar.gz format. 7-zip can be downloaded from http://www.djangoproject.com/r/7zip.

 

Switch to another directory and startPython. If everything is ready, you can importDjangoModule:

>>> Import Django
>>> Django. Version
(0, 96, none)

Install Django through subversion

If you want to experience new features with certain risks or contribute to DjangoCodeYou should download and install Django from the subverion repository.

Subversion is a free open-source version control system similar to CVS. The Django development team uses it to manage updates to the Django code base. You can use the Subversion client to obtain the latest DjangoSource codeAnd can be used at any timeLocal checkoutUpdate the version of the local Django code to obtain the latest updates and improvements made by the Django developer.

The latest and best Django code is usually called * trunk (trunk )*. The Django development team uses the trunk code to run the product-level site and fully ensures its stability.

 

Installation steps:

    1. Make sure that the Subversion client is installed. You can download this software from http://subversion.tigris.org/free and get outstanding documentation from http://svnbook.red-bean.com.

    1. UseSVN CO Http://code.djangoproject.com/svn/django/trunk DjtrunkCommand to check out mainstream code.

    1. CreateSite-packages/Django. PTHAnd setDjtrunkDirectory to add or updatePythonpathSet and point itDjtrunk.

    1. SetDjtrunk/Django/binAdd it to the system variable path. This directory contains some imagesDjango-admin.pyAnd other management tools.

       

Tip:

If you have never touched. PTHFile, you can get more related knowledge from http://www.djangoproject.com/r/python/site-module.

 

After downloading from subversion and performing the preceding steps, you do not need to execute it again.Python Setup. py InstallYou have already manually installed it!

 

Because the updates to Django's main code often include bug fixes and feature additions, if you are really fascinated, you may want to update it every short time. InDjtrunkRun in DirectorySVN UpdateCommand to update. When you use this command, subversion will contact the http://code.djangoproject.com to determine whether the code is updated, and then apply all the changes since the last update to the local code. That's simple.

Install Database

1. PostgreSQL

Official Website: (http://www.postgresql.org /)

: Windows platform http://www.djangoproject.com/r/python-pgsql/windows/.

2. SQLite 3

Official Website: (http://www.sqlite.org /)

: Http://www.djangoproject.com/r/python-sqlite/

3. MySQL

Official Website: (http://www.mysql.com /)

: Http://www.djangoproject.com/r/python-mysql/

4. SQL Server and Oracle

Trying to make it support SQL Server and Oracle

 

 

First test project

1. CreateMysiteDirectory

RunDjango-admin.py Startproject Mysite

 

Let's take a lookStartprojectWhat are created:

 
Mysite/_ init _. py manage. py settings. py URLs. py
File description:
    • _ Init _. py: Let Python treat this directory as a file required by an Development Kit (that is, a group of modules.

    • Manage. py: A command line tool that allows you to interact with this Django project in multiple ways.

    • Settings. py: Set or configure the Django project.

    • URLs. py: The url declaration of the Django project, that is, the content list of the Site Supported by Django

2. Development Server

RunPython Manage. py RunserverCommand

Output:

 
Validating models... 0 errors found. Django Version 1.0, using settings 'mysite. setting' development server is running at http: // 127.0.0.1: 8000/quit the server with lhj588-pc.

Change host or port

By default,RunserverThe command starts the development server on port 8000 and only listens to local connections. To change the server port, you can pass the port as a command line parameter:

 
Python manage. py runserver 8080

You can also change the IP address of a server listener. This feature is particularly useful if you want to share the same development site with other developers. The following command:

 
Python manage. py runserver 0.0.0.0: 8080
 use a web browser to access http: // 127.0.0.1: 8000/

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.