CentOS 6.4x64 Django Development Environment Setup (upgrade python2.6.6 to 2.7.3)

Source: Internet
Author: User
Tags install django pip install django

Recently learning Python language, when learning to Django, ready to build a Django development environment, after several twists and turns, the final configuration success, now the configuration process, for everyone to learn to communicate:

Server environment:

CentOS Release 6.4 (Final) x64


1. Download the release file for Nux

wget HTTP://LI.NUX.RO/DOWNLOAD/NUX/DEXTOP/EL6/I386/NUX-DEXTOP-RELEASE-0-2.EL6.NUX.NOARCH.RPMRPM-IVH Nux-dextop-release-0-2.el6.nux.noarch.rpmyum-y Install python27yum-y Install Python27-devel


2, upgrade Python

CentOS uses python2.6.* by default and requires python2.7 files to overwrite python files.

CD/USR/BIN/RM-RF PYTHONCP python2.7 python

3, test

Enter the Python--version on the command line, if the output shows the result is correct:

Python--version

Python 2.7.3


4, because Yum does not have compatible python2.7, change #!/usr/bin/python to #!/usr/bin/python2.6.

Vi/usr/bin/yum

#!/usr/bin/python

Modified to:

#!/usr/bin/python2.6


5. Install Pip

First you need to install Setuptool

wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5= Fe1f997bc722265116870bc7919059ea--no-check-certificatesh Setuptools-0.6c11-py2.7.egg

Install PIP

wget--no-check-certificate http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz tar zxf pip-1.0.2.tar.gz CD pip-1.0.2 python setup.py install

6. Install Django: (if PIP cannot be installed, you can download the Django package and install it with the Python command)

Pip Install django==1.7.7

After the installation is complete, view the installation version:>>> import django>>> Django. VERSION (1, 7, 7, ' final ', 0) >>> print (Django.get_version ()) 1.7.7

The Python upgrade is now complete.


7. Create a Django Project

django-admin.py Startproject TestWeb

The above command creates a testweb directory that contains the basic configuration files required to run the Django project.

Include the following documents:

__init__.py: Let Python treat the directory as a required file for a development package (that is, a set of modules). This is an empty file, generally you do not need to modify it. manage.py: A command-line tool that allows you to interact with the Django project in a number of ways. Type Python manage.py help and see what it can do. You should not need to edit this file; it is purely for convenience to generate it in this directory. settings.py: The setup or configuration of the Django project. View and understand the types of settings available in this file and their default values. The URL setting for the Urls.py:django project. Visualize it as the directory for your Django site. Currently, it is empty.


8. Run the development server

CD testweb## #python manage.py runserver IP: Port python manage.py runserver 192.168.20.233:80

9. Test access:

CentOS 6.4x64 Django Development Environment Setup (upgrade python2.6.6 to 2.7.3)

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.