Python network programming----first knowledge of Django

Source: Internet
Author: User

what is a web framework

As long as you know a little bit about how to build a dynamic website, then you must be able to experience how painful it is to invent certain standard features repeatedly. You have to create a database structure, export data to the database, process URLs, authenticate users, provide editing tools, and be concerned about security and usability ....
Finally, you realize that it's a waste of life to re-implement these features every time. So, you decide to re-develop your own library to provide these features. Or, extract these libraries from your latest "creations". Then, if you want to start a new project, the first thing you need to do is install your library. It'll save you a lot of money.
Working hours.
But things are not that simple. If the customer needs a feature that is not in your library, it's okay to add in. And every customer needs something different, and the result is that you have different versions of the libraries you install on each server.
There is absolutely no way to maintain it.
After the lesson, you go back to the base library and the best add-on from the various projects to regroup. For most projects you no longer need to directly adjust the library code, just need to change the configuration file, although your codebase is getting bigger and more complex, but it has become very powerful.
The code base you have completed is called a web framework.

Django

Django is an open-source Web application framework written by Python. The MVC Software Design pattern is used, i.e. model M, view V and Controller C. It was originally developed to manage some of the news content-based websites of the Lawrence Publishing Group. The main goal of Django is to make it easy to develop complex, database-driven Web sites. Django focuses on component reusability and "pluggable", agile development and dry rules (Don ' t Repeat yourself). Python is commonly used in Django, and even includes configuration files and data models.


Installing Django1. Since Django itself is written by Python, install Python first.

(Can download according to reader's current version): http://www.python.org/download/releases/3.3.4/
Django (Django 1.6x above is fully compatible with python3x): https://www.djangoproject.com/download/

2.Django after download for the compressed package, unzip and python in the same root directory, under Cmd into the Django-1.7.2 (reader may version of the different) directory, execute Python setup.py install, and then start the installation, Django will be installed into Python's lib under Site-packages.


StartUse the following command in CMD to create the project:
Django-admin Startproject MySite

A folder is generated under the current directory with the following directory structure
MySite
├──manage.py
└──mysite
├──__init__.py
├──settings.py
├──urls.py
└──wsgi.py

1 directory, 5 files

Enter Python manage.py runserver 8000 start server
Visit http://127.0.0.1:8000/


Python network programming----first knowledge of Django

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.