Python uses django to build a web development environment, pythondjango
Install Python
Go to the official Python website and find Python 3. Select a 32-bit or 64-bit installation package based on your system. Download the package and double-click it to install it.
Check whether installation is complete
C:\WINDOWS\system32>python -VPython 3.5.2
Use the virtual environment Virtualenv
Install Virtualenv
C:\WINDOWS\system32>pip install virtualenv
After the installation is successful, you can create a virtual environment and specify a directory you like.
C:\WINDOWS\system32>virtualenv d:\Envs\blogproject_env
The virtual environment has been created. We need to activate this environment.
C:\WINDOWS\system32>d:\Envs\blogproject_env\Scripts\activate
Note that there is no Scripts \ directory in Linux and it is replaced by the bin/directory. And the activation command is
$ source blogproject_env/bin/activate
Install Django
Use pip command
(blogproject_env) C:\WINDOWS\system32>pip install django==1.10.6
Test whether the installation is successful.
(blogproject_env) C:\WINDOWS\system32>pythonPython 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import django>>> print(django.get_version())1.10.6>>>
Create a Django Project
Run the command to enter the d: \ Workspace directory and define the Workspace.
(Blogproject_env) C: \ WINDOWS \ system32> cd d: \ Workspace
Create a project
(Blogproject_env) d: \ Workspace> django-admin startproject blogproject
The internal file structure is as follows:
blogproject\ manage.py blogproject\ __init__.py settings.py urls.py wsgi.py
Running Server
(blogproject_env) d:\Workspace\blogproject>python manage.py runserverPerforming system checks...System check identified no issues (0 silenced).You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.Run 'python manage.py migrate' to apply them.December 21, 2016 - 20:23:07Django version 1.10.4, using settings 'blogproject.settings'Starting development server at http://127.0.0.1:8000/Quit the server with CTRL-BREAK.
Enter http: // 127.0.0.1: 8000/in the browser and you will see the following page prompt:
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.