Django Learning 1-django Installation

Source: Internet
Author: User

    1. Install the Python installation tool Pip and check to see if Django has been installed before.

sudo apt-get install Python-pip

2. Install a virtual Python environment that does not affect the current Python environment.

sudo apt-get install python-virtualenvmkdir ~/django #创建一个用于工作的python的独立目录 (name any) virtualenv env #运行命令virtualenv Env creates an Pyhton standalone environment called ENV (name arbitrary), and this environment and native Python environment do not affect each other. SOURCE Env/bin/activate #启用env环境. Pip install-i http://mirrors.aliyuncs.com/pypi/simple django==1.4 #安装1.4 version of Django

3. Check the Django Installation

Enter the python environment >>>import Django>>>django. VERSION

Iv. Creating a Project

Django Project is a Django example that includes a set of settings, such as database settings, Django-specific options, and some configuration of your program. If you use Django for the first time, you need to do some initialization work.

Create a new working directory:

mkdir ~/work

Go to the directory you just created
django-admin.py startproject mysite #这条命令会在当前目录下创建一个 mysite subdirectory
Tree ~/work #观察work目录的结构

Five. Run the development server

CD Mysitepython manage.py Runserver This way, you have a listening 8000 port on your computer and only accept servers that are locally connected from your own computer. The server is now available with a browser to access Http://127.0.0.1:8000/
Python manage.py runserver 8080 #可以修改端口.


This article is from the "North Son" blog, please be sure to keep this source http://itbullet.blog.51cto.com/6681459/1878586

Django Learning 1-django Installation

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.