简体   繁体   中英

Are there any Web Server modules in python?

I am looking for a web server module for python to work as a part of an application.

I tried SimpleHTTPServer but it doesn't process python files. It serves the source code as text instead which is not what I am trying to accomplish. I need the server to be a module of python and process python files and serve the return of these files.

Is that possible ? Are there any (Simple,Light weight)good [or bad] modules to do that ?

There are many frameworks that will do what you are asking, but it is up to you to decide which one will be best. Here are some you should look into:

Django is full featured, with models, views, and templates. Webpy is super light weight, but closer to the bare metal. Tornado is fast, light weight, and has a nice template language similar to Django.

cherrypy

CherryPy is a pythonic, object-oriented web framework

CherryPy allows developers to build web applications in much the same way they would build any other object-oriented Python program. This results in smaller source code developed in less time.

CherryPy is now more than seven years old and it is has proven to be very fast and stable. It is being used in production by many sites, from the simplest to the most demanding ones.

twisted has a web module.

Twisted is an event-driven networking engine written in Python and licensed under the open source. Twisted also supports many common network protocols, including SMTP, POP3, IMAP, SSHv2, and DNS.

是否由于某些原因您不能使用CGIHTTPRequestHandler

You could take a look at Django , which has a development server included. It might be a bit heavy for your needs though.

Nicholas Piël did an excellent technical summary of the many different options, including benchmarking the lot of them. The article is here, and is definitely worth a read:

http://nichol.as/benchmark-of-python-web-servers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM