Build a Django environment in windows
The premise is that python and mysql have been installed on windows machines.
First, download these files: python-mysql, django
Mysql-python is an executable file and can be directly installed.
1. install django
Now we need to install django and decompress the downloaded package to any Directory:
Decompress django to any Directory
Open the command prompt (cmd), enter the directory, and type the following command:
Python setup. py install
After you press enter to execute the command, you will see the django installation process. after the installation is complete, you can delete the decompressed directory.
2. set django environment variables:
In this way, we have installed django.
Test
There is no sense of accomplishment when the environment is ready. let's have a sense of accomplishment. create a project with django and run it:
First, open cmd and locate any directory under the Directory where you want to create a new project. then, type the following command:
Django-admin.py startproject hello
Hello is the new project directory file name. after confirmation, django creates a new project for us. the hello folder contains django framework files and default configuration files. we don't care about the details first.
Next, locate the cmd path to the hello directory and execute the following command:
Python manage. py runserver
Django server enabled successfully
Open your browser and visit: http: // 127.0.0.1: 8000/. try it and see what will happen.
Note: This server is only a lightweight server built into django for testing and cannot be used in the product environment.
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