Python3.6+django2.0+pycharm Build Web development environment

Source: Internet
Author: User
Tags windows x86 install django pip install django

Step 1.1: Install python, configure the Python environment

Python download directory: https://www.python.org/downloads/mine is window7 install the Windows x86-64 Executable installer version. Reference Links: https://jingyan.baidu.com/article/0bc808fc42dfab1bd485b99f.html, note Configuring the Python environment


Step 1.2: Install Pycharm reference: https://jingyan.baidu.com/article/72ee561a59694be16138df3a.html


Step 1.3: Install Django, I tried two methods, after installation, please put C:\Program Files\python36\lib\site-packages\django; C:\Program files\python36\lib\site-packages\django\bin; Add environment variable, this is my installation directory, here are two ways:

The first is a if configure Pyhton environment, directly open cmd, input pip install Django


The second opens the Pycharm and selects the default setting for the File menu


Double-click the right area, pop-up, enter the Third-party library you need, click on the install package below, most of the Python Third-party libraries can be installed in this way


The installation environment is now configured to complete.



Let's go to the first Web configuration tour

Step 2.1: In a DOS environment, enter the directory where you want to put the project, use django-admin.py to create the project, for example, I want to create a Hello World project under D:\, then I enter the DOS environment into the d:\ Execute the following command: django-admin.py startproject Hello World as follows:




After successful execution, a HelloWorld folder is generated under D:\


Step 2.2 Open this project with Pycharm

File-->open--> Select D:\helloworld as shown:


So, opened the HelloWorld this project

Step 2.3. As shown in the diagram configuration, run this project.


After saving, run directly, this project will be able to run up.


SETP 2.4 Next create the first app. Execute DOS command in the project's directory: django-admin.py Startapp SayHello, you will create a SayHello app in the project's folder, as shown:


At the same time we can see this app in Pycharm, we can write our code in the views.py file in the SayHello folder: Add the following code:


datetime
httpresponseSayHello (Request):
    httpresponse (' Hello world! ')

Then modify the urls.py file in the project folder, add the URL (R ' ^sayhello/', SayHello), map to the urlpatterns, and then restart our project and enter the http://in the browser 127.0.0.1:8000/syahello will see our results.


So far we have built a Pycharm+django development environment





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.