Hunch

Embedded HTTP server in Smisk 1.1.7

September 1, 2009 by Rasmus Andersson, tagged smisk and software, filed under software

Smisk 1.1.7 will not bring many new features, but one of them is a built-in HTTP server which can be used for local development, removing the need for a “real” HTTP server (e.g. Lighttpd or Apache httpd).

Simply give your application the --http flag:

$ ./app.py --http
httpd listening on localhost:8080 backed by application 6056

You can explicitly specify which host and/or what port the HTTP server should bind and listen to by instead using the --http-addr and --http-port flags.

$ ./app.py --http-port 8888
httpd listening on localhost:8888 backed by application 6034
$ ./app.py --http-port 8888 --http-addr 0.0.0.0
httpd listening on 0.0.0.0:8888 backed by application 6034

Your application will be started in a separate process as a stand-alone FastCGI server listening on 127.0.0.1:5990 and a smisk.util.httpd.Server is started on the main thread, connecting to your application.

Trying out the key-value store example application:

$ examples/mvc/key-value-store/app.py --http
httpd listening on localhost:8080 backed by application 6126
rmbp.local - - [01/Sep/2009 15:32:19] "GET / HTTP/1.1" 200 -
rmbp.local - - [01/Sep/2009 15:32:19] "GET /entry/ HTTP/1.1" 200 -
rmbp.local - - [01/Sep/2009 15:32:26] "GET /entry/my%20key HTTP/1.1" 404 -
rmbp.local - - [01/Sep/2009 15:32:27] "PUT /entry/my%20key HTTP/1.1" 204 -
rmbp.local - - [01/Sep/2009 15:32:29] "GET /entry/my%20key HTTP/1.1" 200 -
rmbp.local - - [01/Sep/2009 15:32:30] "DELETE /entry/my%20key HTTP/1.1" 204 -
rmbp.local - - [01/Sep/2009 15:32:31] "GET /entry/my%20key HTTP/1.1" 404 -
rmbp.local - - [01/Sep/2009 15:32:32] "GET /entry/ HTTP/1.1" 200 -

It’s currently being tested in smisk/master and can thus be checked out, built and tested.

2

Smisk 1.1 released

December 19, 2008 by Rasmus, tagged python, smisk and software, filed under software

Smisk 1.1 have been released, including an extensive python library introducing Content Negotiation, MVC design pattern support and much more.

Smisk is a web service framework for Python. Learn more about Smisk at the Smisk website. There is also some brand new documentation available.

Continue reading...

3

Smisk in Spotify

November 24, 2008 by Rasmus, tagged python, smisk, software and spotify, filed under software

Smisk

Spotify replaced Twisted with Smisk for one of its backend services, which marks the first serious deployment of Smisk! Version 1.1 is soon to be released and will be announced on smisk-announce as well as in this blog.

Smisk boosted performance for some services in 10 multiples, when compared to Twisted.

Smisk is a high-performance web service framework, with its core components written in C, but controlled by Python. Smisk also exposes a MVC-inspired package, adding Transparent Content Negotiation, class tree routing, templating, ORM-support, etc. Read more at the Smisk website.

Smisk 1.0

May 12, 2008 by Rasmus, tagged programming, python and smisk, filed under software

So, after two years, The Smisk web service framework has finally been released as a stable version.

Smisk is a small but powerful framework, or more like a base, for building and running high-performance web services, based on FastCGI. Before I get any further, here is the classic example:

from smisk import Application
class MyApp(Application):
  def service(self):
    self.response.write("Hello World!")

MyApp().run()

This example is obviously not much to hang up in the christmas tree, as we say in Sweden, but there’s definitely more. The major feature of Smisk is it’s speed and this because of the fact that it’s written in C. Yes, not Python. It’s a machine-native library that manifests itself as a Python extension thus control is done with Python.

Installing Smisk is very easy if you have setuptools:

sudo easy_install smisk

(There are other means of installation available…)

As I mentioned earlier, Smisk is a FastCGI based entity. As the name suggests, this is a fast interface, or a fast proxy interface, for HTTP services. FastCGI was built to do two things in particular: Be as fast as possible and scale as good as possible. Smisk retains both of those criteria.

Continue reading...