The structure of the website with old Ziko python

Source: Internet
Author: User
Early and early, computer this thing is used to be called computer, because its main function is to complete some scientific calculation of things, I remember when I tinker with it, is calculated, there is no thought it can be used to do other early days. Later another name "computer" gradually received by people, especially after the development of the network, computer this thing, if you are not online, simply do not know what to do. And, now there seems to be a trend, more and more strengthen the role of the network, and the function of the machine although the hardware in the promotion, can do things feel little.

No matter what, the network is inseparable. What do you do after surfing the internet? is to login to XXX website. Not the internet after the automatic content into their own computer, but to operate the browser, enter the URL, open a website page, to get what we want to see. So, on the network, must have the website, can let others see. Internet-look at the web, this is the frequency of very high action.

So here's the website. Who made the site? It's nonsense, people do. But the people here may be working for a company, or they may be like self-employed.

How does the website do it? It's a lot of practice. There is a direct HTML page written, useful what other open source system to do, and so on.

Starting from this talk, I and yours faithfully crossing to see, with Python How to make a website.

Wikipedia has the following description of the website:

Web site (English: Website) refers to the Internet, according to certain rules, using tools such as HTML to display a specific content of the relevant pages of the collection. Simply put, a website is a communication tool, like a bulletin board, where people can publish information they want to make public, or use a website to provide related Web services. People can access the website through a Web browser, get the information they need or enjoy the Internet service. The world's first website was created by Tim Berners-Lee on August 6, 1991.

Website composition

The site is composed of two major parts, one is the server, and the other is the program.

Server, which is the hardware part. If the crossing have the condition, can buy their own server, and then set up their own computer room or host to what the letter room, etc., so that has its own server. Of course, it takes a lot of silver. If the silver is not enough, you can save money to buy the server space provided by a company, because the benefits of market economy, people will always think that not everyone can afford to buy the server, nor is it necessary for everyone to buy their own servers. However, if you want to do the site, you do not own the server to do? So, someone to do this business, rental of his own server part of the space for the poor, so that the win, the poor as long as the technology, you can have a low price on the internet to have their own website, the rich (rental server) can also be rented rent. It's like having a house-renting relationship with a landlord. Of course, the result is the need to hire a server with others, if you rent a separate, the price is more expensive.

If, I mean if, if you do the site is not intended to be put on the internet to let others see at any time (there is this?). Isn't that white? Yes! And many, such as my site has not been done, I will not let others see it, this time can also use their own computer as a server, in their own computer to publish their own website, self-appreciation, when necessary to put the next person to the front of the monitor to see it. Very narcissistic. (in their own computer publishing site, in fact, can be seen through the Internet, it is necessary a little bit of technology to release, this is not the focus, this tutorial does not speak, the need to Google or contact me. )

Crossing and I in the subsequent study, the use of the server is their own computer. We all like to be narcissistic.

The other part is the server inside the software part, usually said the website, more refers to this part. Generally speaking, this part is more complicated, because the site is different, and there are many different programs. However, no matter what site, there must be a screen for others to look at, this is a Web page, or, as long as there is a Web page, it can be used as a site to publish.

Then there is a relatively simple site, is composed of a number of web pages, and, these pages are just written in HTML code (or with HTML page editing tools, you can edit the Web page), I think of the first to do that page, is purely in HTML code written. The pages are written in the jargon as "static". It means that it does not allow users and sites to interact, just let others see. For example, the spectator hand owes, do not want to search for anything, sorry, the site does not provide this feature. This kind of website is now relatively few.

What if you want to add interactivity? There is a program that handles the information that users submit to the site. In this way, the site is more part of the jargon is often said to be "back-end", corresponding to the former said that the direct display to the spectator is called "front-end." What "backend" does is to process the information submitted by the "front end" user, and then give the user a feedback. This makes the interaction.

In addition, in order to save the data on the site, usually use a "database" of things (this is not necessary, some sites do not have a database, some sites store data in other ways, such as text, etc.), the database is mainly to store some data, so that the back end of the site and the front end from here to read out some data, Display to crossing, or save some of the data submitted by crossing in order to be used later.

Database is a professional door in the computer industry, crossing is interested, can be in the industry in-depth, the company has a position: DBA, is to do this.

The database, in a nutshell, is an electronic file cabinet-the place where electronic files are stored, and users can run new, intercepted, updated, deleted, and other operations on the data in the file.

Database administrator (English: Database administrator, DBA), is the person responsible for managing databases. The database administrator is responsible for running the database on the system, performing backups, enforcing security policies, and maintaining the integrity of the database. Because managing a database is a huge job, the needs of each company or organization's database administrator are very different. A large company may have many database administrators, but a small company may not have a database administrator and let the system administrator manage the database.

The following, generally speaking, the site should be like this:

In order to write a beautiful front end, generally use CSS and JavaScript, but this tutorial, because not specifically taught these, so, when it comes to the front-end, there is no CSS and JavaScript, such a bad result is the interface is rather ugly. Please crossing endure it.

On the control side, which is the back end of the front, only one language is available: Python. This is the ultimate goal of this tutorial, how to make a Web site with Python.

Database, I chose MySQL, there are many legends about this database. For example, Wikipedia says:

MySQL (official pronunciation for English pronunciation:/maɪˌɛskjuːˈɛl/"My S-q-l", 1, but also often read as English pronunciation:/maɪˈsiːkwəl/"My Sequel") was originally an open source relational database management system, The original developer was the Swedish MySQL AB company, which was acquired by the Sun Microsystems in 2008. In 2009, Oracle (Oracle) acquired Sun Micro Systems, and MySQL became a product of Oracle's.

MySQL has become the most popular open source database in the past due to its high performance, low cost and good reliability, so it is widely used in small and medium-sized websites on the internet. As MySQL matures, it is increasingly used for more large-scale websites and applications such as Wikipedia, Google and Facebook. The very popular open source software combination of "M" in lamp refers to MySQL.

Oracle, however, has sharply increased the price of the MySQL commercial edition, and Oracle no longer supports the development of another free software project, OpenSolaris, As a result, the free software community has some concerns about whether Oracle will continue to support MySQL Community Edition (the only free version of MySQL), so some of the original open source software that uses MySQL is moving to other databases. For example, Wikipedia was formally announced in 2013 to migrate from MySQL to the MARIADB database.

Anyway, MySQL is still a good database choice, enough to support crossing to complete a fairly small site.

As for the server space, put it on your own computer.

Start with the database

Database is the site we want to do a foundation, I do not demonstrate the situation here without a database, because the kind of toy website, although the lecture is simple, but crossing always a little dizzy, distance from the real environment is too big, since the study, learning points really.

From now on, enter the process of website construction.

Install MySQL

Your computer will not be born with MySQL, it is essentially a program that needs to be installed on the computer.

If crossing is the same as me, using the Ubuntu operating system, you can use the following methods (I believe that the use of Ubuntu is very rare, however, if crossing to become a good programmer, I still recommend the use of this operating system, or other Linux distributions. haha).

The first step is to run the following command on the shell side:

sudo apt-get install mysql-server

In this way, the database is already installed on crossing's computer. Of course, the configuration is also needed.

Step two, configure MySQL

The default MySQL installation after the root user is no password, crossing note, here is a noun "root user", whose username is: root. Run:

$mysql -u root

Here the reason for using-u root is because I am now a general user (Firehare), if you do not add-u root, MySQL will assume that it is firehare log in. Note that I do not have access to root user mode here because it is not necessary. In general, the database in MySQL operation, there is no need to enter the root user mode, only in the setting of this possibility.

After entering MySQL, you will see the beginning of the > symbol, which is the command interface of MySQL.

The root user password in MySQL is set below, otherwise the MySQL service is not secure.

mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456";

Note that I use 123456 as the root user's password, but the password is not secure, please use a combination of uppercase and lowercase letters and numbers, and not less than 8 bits.

In the future if you log in to the database, you can use the password you just set.

In addition to the above installation process, crossing if you are using a different operating system, you can search for the appropriate installation method on Google, I do not show here, because I can only demonstrate the installation process on Ubuntu. However, Google will help you troubleshoot installation problems.

Running MySQL

After installation, it is necessary to run it and operate the database to build a foundation for doing the site. I'll run the database like this:

qw@qw-Latitude-E4300:~$ mysql -u root -p
Enter password:

Enter the password for the database, and then appear:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 373
Server version: 5.5.38-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

Seeing the content of this interface means that you have entered the data. This data can then be manipulated. For example:

 mysql> show databases;+--------------------+| Database |+--------------------+| Information_schema | | CarStore | | Cutvideo | | Itdiffer | | MySQL | | Performance_schema | | Phpcms | | PHPCMS2 | | Pushsystem | | Sipras | | Test |+--------------------+

With this command, the current MySQL database is listed.

In addition to this command-line operation of the database, there are many tools to manipulate the database in a visual way. Here also do not introduce, interested in please Google. However, I like the command line.

  • 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.