[Python] [Django Learning Article] [Build a simple Django development environment]---don't build mysql for the time being

Source: Internet
Author: User
Tags create directory install django pip install django python script virtual environment virtualenv

http://zmrenwu.com/post/3/

1 Building a Python virtual environment:

    • Install virtualenv (provided that Python and Pip are already installed) pip install Virtualenv
    • Computer New directory: D:\software\python_virtual_envs\djanoproject_env
    • Execute command virtualenv D:\software\python_virtual_envs\djanoproject_env
    • Executing a virtual environment: running D:\software\python_virtual_envs\djanoproject_env\Scripts\activate
    • CMD interface sign (BLOGPROJECT_ENV), indicating that a virtual environment has been entered
    • After entering the virtual environment, ensure that you do not leave to change the virtual environment, if you exit please re-enter

2 Installing the Django Pip install django==1.10.6

3 Check if Django is installed successfully: command line execution python, import Django, print django.get_version () see if the output is 1.10.6

4 Create a Django project (the project is a folder)--There are commands that automatically help us generate the necessary engineering documents (requirements: Create a blogproject Django project in the F:\pythoncode\django\workspace directory)

    • Returned by the Python console to the virtual environment cmd
    • Create directory: F:\pythoncode\django\workspace, and enter the directory
    • Execute command: django-admin startproject blogproject
    • The subdirectory structure is seen in the F:\pythoncode\django\workspace directory:
    • The topmost blogproject is the project directory, __init__.py indicates a package; The project catalog has the following: Blogproject directory and manage.py file with the same name,manage.py is Django For our generated Python script file that manages this project, this script file is just some of the commands.

5 Creating a simple project

  • The
  • cmd interface enters into the manage.py directory, executes python manage.py runserver   command to open a WEB server on this computer:
  • Open in local browser: http://127.0.0.1:8000/
  • Modify the configuration file settings.py to enable the Django browsing interface to support Chinese
    • # language_code = ' en-US '

    • Language_code = ' Zh-hans '

    • # time_zone = ' UTC '

    • Time_zone = ' Asia/shanghai '

[Python] [Django Learning Article] [Build a simple Django development environment]---don't build mysql for the time being

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.