4 ms·
I like the idea but I’m not quite ready to learn a new language at the moment. Can anyone recommend something similar in Python? The single-file part is less im
by SlowBro 9y ago
I like the idea but I’m not quite ready to learn a new language at the moment. Can anyone recommend something similar in Python? The single-file part is less important to me than the simple API. I’m a simple guy and my app will be simple as well :-)
- eeZah7Ux 9y agoBottle is truly single-file, no dependencies and faster than Flask.
- luibelgo 9y agoFalcon has good performance characteristics, nice API: https://falconframework.org https://falconframework.org
- cjalmeida 9y agoIIRC Falcon only does REST, it has no template rendering. (To me, that's a plus)
- aserafini 9y agoThe equivalent framework in Python is probably bottle.py: https://bottlepy.org/docs/dev/ https://bottlepy.org/docs/dev/
- dpwm 9y agoBottle [0] is single file, simple web framework for Python. It's pretty easy to use and well documented. It has no dependencies outside the standard library but can optionally use a number of more robust web servers. Flask [1] has similarities and IIRC the author of Flask, Armin Ronacher, has in the past proposed merging it with Bottle. However, the single file and dependencies thing is where the author of each framework disagrees. Flask has tools that help with structuring larger apps and seems to be more widely used than Bottle. Personally, I prefer bottle for things I know will remain small, just for the lack of dependencies and that I personally find the documentation easier to read. [0] http://bottlepy.org/docs/stable/ http://bottlepy.org/docs/stable/ [1] http://flask.pocoo.org/ http://flask.pocoo.org/
- SlowBro 9y agoThank you, I haven't looked at Bottle. The Hello World is actually comprehensible to me and I was able to mentally crunch the entire tutorial page no problem. I checked out Flask but was overwhelmed, went through the Django tutorial and really couldn't get my head around what I needed to transfer it to my own code. LOL I told you I'm simple... SlowBro may be slow, but he's a bro...
- jamesgeck0 9y agoFlask has _really good_ documentation. Sitting down and just reading the whole manual cover to cover was one of the most productive things I did when I was getting my head around MVC. It's not in Python, but I also really like the tiny Camping framework in Ruby. It's tiny enough and well documented enough that you can read and (more or less) understand the whole thing, even if you're not great at Ruby. My path when learning web development kind of went from Camping to Sinatra to Rails, with periodic detours to Flask. The high level concepts are very similar.
- deleted 9y ago[deleted]
- giancarlostoro 9y agoI'd say Flask will literally let you do that. Though CherryPy will as well if you really want to. I usually don't do CherryPy that way unless I'm building something small and contained enough. If you need templating I used Mako with CherryPy as well. Just look at the "Hello World" for CherryPy you only need that one file to run a web server, supports also running under WSGI and hosting other applications that need WSGI hosting. CherryPy: http://cherrypy.org/ http://cherrypy.org/ Mako: http://www.makotemplates.org/ http://www.makotemplates.org/
- sigzero 9y agoCherryPy is pretty cool. I wish it got more notice. Bottle is another single file Python framework as well.
- giancarlostoro 9y agoGot to use it for production at my job when I was given the freedom to pick any framework. Don't really regret it, though I wouldn't mind trying out Falcon for comparison.
- kakwa_ 9y agoI've used cherrypy + mako in a few projects (https://github.com/kakwa/dnscherry https://github.com/kakwa/dnscherry and https://github.com/kakwa/ldapcherry https://github.com/kakwa/ldapcherry). It's quite easy to pick-up and does the job very well. It supports running directly over http, but you can also run it in wsgi or fastcgi modes without issues. And it's also quite stable in term of APIs, my projects are now 4 years old, and I didn't have any breaking changes in their API. It makes it quite easy to support various distributions and version without kludges in the code to handle different versions or having to bundle cherrypy with the application. Even my monkey patches of the framework (slight change in the configuration parser) are not breaking ^^.
- giancarlostoro 9y agoMy project is 1 year and 6 months old or so and yeah I've had a similar experience. CherryPy is a great framework, and Mako not sure why I chose it was also an equally great choice.
- SlowBro 9y agoBottle looks like the answer. I read through the entire Tutorial in about 30 minutes and understood almost everything without even needing to try it out first. Got to the end and, "That's it? Wow that is simple." One can learn all they need in a short time and get cracking on some apps. First app is a web config interface on a Raspberry Pi-based IoT device. Web config app will be almost identical server-side so as to allow config from anywhere. I was going to do it all in CGI but this is much improved.
- linsomniac 9y agoI've used bottle for little tasks, and it is fantastic.
- fuball63 9y agoAs others have said, Bottle is great, and I use it in almost every side project that uses Python. However, it should be noted that TCL is famous for being a language that can be described in 12 rules: http://wiki.tcl.tk/10259 http://wiki.tcl.tk/10259 And the tutorial is really good: https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html Obviously, there's a lot more online reference material and a bigger community for Python, but if you are interested in learning TCL, don't be afraid to go for it.
- SlowBro 9y agoOh I actually wrote a fairly complex expect script once, many years ago, and forgot most of it :-) It wasn't bad as I recall, but I'm on a timeline so not eager to pick it up again right now. Thanks all the same.
- dezzeus 9y agoPerhaps you may find Hug of your interest… :) http://www.hug.rest/ http://www.hug.rest/
- SlowBro 9y agoIntriguing. That koala sure looks welcoming...
- X-Istence 9y agoI would recommend giving Pyramid a try: https://trypyramid.com/ https://trypyramid.com/ It's a framework that allows you to start with a single file, but also allows you to more logically then split your application up and grow with a huge amount of plug-ability while providing many sane defaults to start off with. It is not a batteries included framework, so it gives you the flexibility to figure out what is best for your application vs being forced into a certain convention. Full disclosure: I am a maintainer for the Pylons Project with a focus on: Pyramid, WebOb and waitress.
- SlowBro 9y agoCool I've bookmarked it, maybe give it a shot if Bottle isn't for me.
- moosingin3space 9y agoI like aiohttp for simple Python HTTP apps.