Karrigell for Python

 

Karrigell for Python


(Page 1 of 4 )

Since Python is not specifically designed for web development, a number of technologies created by Python users exist that aim to provide a web development environment. While the exact approach to the situation varies among each framework, a few of these frameworks really stand out in the crowd. One such framework is Karrigell. Read on to learn more.

Introduction

While Karrigell is very powerful and flexible, offering multiple solutions to web development, it is surprisingly simple to set up and work with. Python novices won't find any obstacles when working with Karrigell, and Python experts won't feel too limited. It offers its own web server that gets the job done, but it also can be easily integrated with technologies such as Apache, so you do not have to sacrifice the use of other technologies when choosing Karrigell.

This article will guide you through the installation of Karrigell and will explore some of the capabilities of the web framework.

Installing Karrigell

Fortunately, there really isn't any complicated magic involved with the installation of Karrigell. The obvious first step is to obtain the web framework, available at SourceForge:

http://sourceforge.net/projects/karrigell

Once you've downloaded Karrigell, extract it to an easily accessible directory, such as . Next, then simply execute Karrigell.py to start the built-in server. If you only want to run the included server and not set up Karrigell to work with another web server, your work is done, and you may safely skip to the next section.

Otherwise, you'll need to configure your web server to interact with Karrigell. We'll take a look at Apache. We'll need the Karrigell web server to run behind Apache, so that Apache can pass off the relevant requests to Karrigell.

Since Apache will likely be running on port 80, you will need to set the Karrigell server on another port. You can either do this through the command line or by editing Karrigell's configuration file. We'll use port 8080 for Karrigell. The first method works something like this:

C:/Karrigell>Karrigell.py -P 8080

To change Karrigell's configuration file to set a default port, simply add this to Karrigell.ini:

port=8080

Now we have to configure Apache to redirect requests for Karrigell. Likely, you will want Apache to deal with all the static files of your website, along with other technologies such as PHP. To do this, you can create identical directory structures in both Karrigell and Apache – or at least for the directors where you want to utilize Karrigell – and configure Apache to redirect requests to Karrigell-associated files to the Karrigell server. All you need to do to set this up is add these lines to Apache's httpd.conf file:

RewriteEngine On
RewriteRule ^/(.*).py(.*) http://localhost:8080/$1.py$2 [L,P]
RewriteRule ^/(.*).ks(.*) http://localhost:8080/$1.ks$2 [L,P]
RewriteRule ^/(.*).hip(.*) http://localhost:8080/$1.hip$2 [L,P]
RewriteRule ^/(.*).pih(.*) http://localhost:8080/$1.pih$2 [P]

If you want to, you can also set Apache to redirect all of the particular files in a directory to Karrigell. We'll be using a directory called testarea throughout this article, so to configure Apache to redirect all requests to a file within that directory to Karrigell, add this to httpd.conf:

RewriteEngine On
RewriteRule ^/testarea(.*) http://localhost:8080/testarea$1 [P]

You could also modify the first set of configuration directives so that they only apply to a certain directory:

RewriteEngine On
RewriteRule ^/testarea/(.*).py(.*)
http://localhost:8080/testarea/$1.py$2 [L,P]
RewriteRule ^/testarea/(.*).ks(.*)
http://localhost:8080/testarea/$1.ks$2 [L,P]
RewriteRule ^/testarea/(.*).hip(.*)
http://localhost:8080/testarea/$1.hip$2 [L,P]
RewriteRule ^/testarea/(.*).pih(.*)
http://localhost:8080/testarea/$1.pih$2 [P]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值