We are searching data for your request:
Upon completion, a link will appear to access the found materials.
Josh watch dogs 2.0
I’m pleased to announce the 2.0 release of Jaws! This version is a complete redesign, incorporating ideas from both the 2.0 and 1.x line of Jaws and making the code far more maintainable and extensible.
I’ve spent the last six months refactoring Jaws and removing almost all dependencies on the Python 2.4 and Twisted 1.2.2 libraries, in particular. This refactoring, along with my personal bias for Python 3, means that this release is compatible with Python 3.3 and newer versions of Python.
This new release also removes the dependency on Python 3.3’s C-API-only PEP-3115 support, replacing it with the more Python 3-style support that was added to Jaws when Twisted transitioned to its 2.0 release in March, 2012.
There are many new features in this release, and you can read about them in detail in the release notes. But here’s a quick summary:
Jaws can now listen for changes to the file system and reload itself automatically whenever a file or directory is added, removed, or modified.
Jaws can now reload itself if any Python modules or sub-packages are updated.
New error reporting and logging facilities were added to Jaws to make it easier to diagnose errors in your code.
There’s a new command-line Jaws program, jaws-quickstart, which takes care of the setup and configuration for you.
Jaws now supports HTTPS servers and web servers.
A new option, --no-proxy, prevents the web server from performing DNS lookups through an HTTP proxy.
Jaws can now authenticate users based on username and password.
Jaws can now be run from inside a virtualenv, allowing you to run it as a stand-alone web server without interfering with the global environment.
A new test suite was added to Jaws to make it easier to write unit tests for the code in Jaws.
Several bug fixes were also made.
As usual, there’s a link to the release notes below.
This version of Jaws is available for download from the Jaws Download Page, and the tarball for the 1.x version is still available on the Downloads Page. If you have an account on PyPI, you can simply add this distribution to your Pypi account to access the Jaws packages, as described on the PyPI Getting Started Guide.
And don’t forget to check out my recent PyCon talk on Jaws, where I also demoed the 1.x version.
It’s been a long time since I posted about Jaws, but here I am again.
What’s new in this release?
Jaws is a web server for Python applications. It’s designed to be easy to use, but it’s also flexible enough to allow you to do some things that are difficult in other web server libraries.
It supports HTTP authentication, and the code is designed to make it simple to integrate into your own software, using the built-in web server as a starting point.
You can also run Jaws in an isolated virtualenv so that you can have a web server running in its own isolated environment without conflicting with the rest of your Python packages.
I’ve been working on a lot of improvements to the Jaws library, which is now called TwistedWeb. Jaws and TwistedWeb both use the same WSGI middleware, so applications built using Jaws will work the same in a TwistedWeb web server as they would in a regular web server.
I’ve also been working on a lot of the new features that I mentioned in my last post, so here’s a rundown of what’s in the new Jaws.
If you’ve ever had to modify your Jaws config file or tweak some of the settings in your program, then you’re familiar with the tedious business of having to run your application on your web server, restart your web server, reload the web server, and then start your application again. With Jaws, it’s just a matter of telling your application to reload itself when a new file or directory is added, or a new version of a Python module or sub-package is loaded.
To accomplish this, the TwistedWeb WSGI middleware has been modified to automatically reload the web server whenever any Python modules are modified. This means that, in addition to reloading the web server when files or directories are added or removed, Jaws will automatically reload itself when an application is running and a new version of a module or sub-package is loaded.
Here’s an example:
from jaws import twisted, web
class MyApp ( web. Application ):
@ twisted. web. resource
def main ( self ):
self. add ( '/', web. HTTP, self. MyApp )
@ twisted. web. resource
def index ( self ):
return web. HTML ( '<,h1>,Hello, World!<,/h1>,' )
app = MyApp ()
app. listen ( "0.0.0.0", 8000 )
And to start your application:
$ python3 jaws-quickstart.py
And now browse to http://127.0.0.1:8000 to see a “Hello, World!” page!
You can also configure the version of the TwistedWSGI middleware that Jaws uses for reloading. This can be done with the reloader parameter when you create a Jaws application.
If you use the default settings, Jaws will use the middleware shipped with TwistedWeb, and it will automatically reload the web server every time you modify a Python module or sub-package. To tell Jaws to only reload itself when a file