Simple learning of Python's web framework Django (i)

Source: Internet
Author: User

My Learning environment is Windows 7, first install Python, I installed the version is Python 2.7, after the confirmation "C:\Python27\Scripts; C:\Python27; " These two paths are added to the path system variable.

Figure A

Then download Django. The version I downloaded is django-1.8.tar.gz. Then unzip, the command line into the extract directory, with the "setup.py Install" command to install. After the installation is complete, enter "Import Django" in the Python shell, and if there is no error, Django has been installed successfully.

Figure II

Create a new folder in any location (with no name), such as Mywebsite. Enter mywebsite in the cmd window and create a new Django project named MySite with "django-admin.py startproject MySite". (In fact, after installing Django, there is a django-admin.exe tool in the scripts directory under the Python installation directory, which is what is used here.) )

Might

Figure Four

Once the Django project is built, we can look at its directory structure. In the MySite project directory, there is a manage.py file, and there is a mysite directory.

Figure Five

In the MySite directory, there are __init__.py, settings.py, urls.py, wsgi.py four files.

Figure Six

Django comes with a Web server for rapid development, and we Run "manage.py runserver" in the MySite project directory to start it. When "Quit the server with Ctrl-break" appears, the server started successfully.

Figure Seven

The URL in the browser to access the prompt when the server starts. At the same time, we can also see the cmd window where the server records the GET request ().

Figure Eight

Simple learning of Python's web framework Django (i)

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.