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