Use Python and karrigell as the website. Article 1

Source: Internet
Author: User
From today on, I will learn how to use Python/karrigell as a website.
For this article Article He must have a general understanding of what karrigell is, but it doesn't matter if he doesn't know anything. although this word is complex and Kingsoft doesn't know how to explain it, it actually means very simple.
Karrigell, a Web application that supports Python Development Program The framework is a web server that can interpret Python scripts. if you use python to write a Web page, clicking Browse directly is definitely an error, because although your machine is installed with a python runtime environment, this environment is not particularly designed for web development. but if you have installed karrigell on the machine, you can browse this webpage.
The following describes how karrigell works. karrigell provides the following functions:

Provides a variety of methods for you to develop web pages using Python
Provides a variety of web feature services (such as sessions)
It is a web server that can interpret and execute web pages, but can also be combined with other Web servers (such as APACHE)
It provides a small database to interact with Python web pages, but other databases (such as MySQL) can also be used)

So why do we need to learn about karrigell as an entry-level course for "developing web programs using Python? There are only two reasons: simple.
Karrigell is easy to install, easy to use, and easy to learn... therefore, you can easily step into the python + web world (of course, I am also a beginner, and this last sentence is also my good wish ^_^)

The last question left after this trip: What is Python?
Http://www.cnblogs.com/notus/archive/2007/09/28/909674.html
(Just kidding, but if you really don't know, then orz)

1. Install karrigell
Here we will download the latest karrigell. I am using 2.3.6
Http://karrigell.sourceforge.net/
After the download, decompress the package and put the folder in a directory that is easy to find. For example, I put them here c: \ karrigell236
So far, the installation of karrigell has been completed. (It is so simple)

2. Start the karrigell Service
Find karrigell. py in the folder and double-click it. If no problem exists, the following command line window is displayed.
---------------------------------------
Karrigell 2.3.6 running on port 80
Debug level 1
Press Ctrl + C to stop
----------------------------------------
This indicates that the karrigell service has been started. Now, you can run the Python web page.

3. Main directory of the karrigell Service
The default Web home directory is in c: \ karrigell236 \ webapps
Enter http: // localhost in the browser to open the "Welcome to karrigell" page, which is the index.html in the directory.
If your machine is still running on other Web servers, such as IIS, karrigell will occupy the URL of http: // localhost. I mean, before karrigell is installed, you use http: // localhost to open a specified website directory, however, after karrigell is installed, this address will be displayed as the welcome page of karrigell, instead of the previous one.
We will certainly solve this problem in the future.

4. karrigell Configuration
We are familiar with IIS and have detailed and friendly configuration management. however, karrigell can only use karrigell in the directory. configure the INI file. you can configure the main directory and port used by karrigell. for example, to solve the problem above, I specified a non-80 port for karrigell.
Port = 6001
In this way, the next time you run karrigell, port 6001 will be used. Accordingly, you need to access the main directory of karrigell through http: // localhost: 6001/

5. Edit the webpage
This is a very important issue. We have been working on a website for a long time. as far as I know, karrigell supports HTML and other files. py and. file with the PIH extension. the first one is obviously a python program. The following is a special example of using htmlCodeA webpage written in combination with python. It doesn't matter if you don't know it now. You will know it later.

6. The first Python web page
Now, let's create a hello. py under c: \ karrigell236 \ webapps and enter the line of great code.
Print 'Hello world! '
Use http: // localhost: 6001/Hello. py for access. The page is displayed as follows:
------------------
Hello world!
------------------
The first Python web page in your life was born like this...

7. Other resources
Open the welcome page of karrigell and find many useful resources, such as examples, documents, email lists, and so on.
If you are fond of reading Chinese, I have found a good thing today. On csdn, a good man translates karrigell documents in Chinese.
Http://blog.csdn.net/chumpklutz/
In addition, this article is a good introduction to karrigell. Our next step may be to translate this article into Chinese.
Http://www.devshed.com/c/a/Python/Karrigell-for-Python/

This article will certainly be a series of articles, unless I find myself not interested in Python one morning.
Hope you can make progress together!

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.