# Web Frameworks



## Phishfry (Jan 17, 2017)

Looking to learn a web frameworks. I want opinions on what to use. Today I bought some books on python.
I want lightweight for embedded usage and I am leaning toward Pyramid.

A fellow user here showed a nice Ajax and Python interface that impressed me..
So many choices even within the python community.

I am not looking for fancy menus or buttons but would like some instrumentation type widgets.
Dials and Bars for a digital dashboard fed from GPIO signals.

Can nginx handle this or should I move to apache?


----------



## Cthulhux (Jan 17, 2017)

Phishfry said:


> I want opinions on what to use.



http://learnbchs.org

Perfectly AJAX-capable, low on resources and incredibly well performing. Also, it supports GPIO rather well.


----------



## roddierod (Jan 17, 2017)

I'd cast my vote for Flask


----------



## Cthulhux (Jan 17, 2017)

Python is not exactly _lightweight_ though.


----------



## Phishfry (Jan 17, 2017)

Here are some of the widget types I would like. Is this going to be possible with a web frameworks and not a full graphical toolkit?

http://qwt.sourceforge.net/controlscreenshots.html
https://sourceforge.net/projects/giw/


----------



## Cthulhux (Jan 17, 2017)

Those are desktop widgets, not web widgets.


----------



## Phishfry (Jan 17, 2017)

I am still trying to decide what to use, so I may end up using GTK+ instead. Really unsure which way to go.

Back to python, the code I used seemed rather petite, is it the python frameworks/libraries that are not lightweight or the coding itself?


----------



## Cthulhux (Jan 17, 2017)

Gtk+ is not a web framework. 

Regarding Python, the language itself requires a decent level of verbosity (cf. https://www.python.org/dev/peps/pep-0020/) and the interpreter is known for being one of the slowest available. While Python is awesome for prototyping, it certainly does not fit your requirements.


----------



## obsigna (Jan 17, 2017)

There is some movement towards the Swift programming language for Web development -- one prominent driver is IBM, for example see:

https://developer.ibm.com/swift/kitura/
http://www.kitura.io

The advantage of Swift over Python, Java, and JavaScript type frameworks is, that Swift compiles into native binaries on the target platform while at the same time bringing all the flexibility of said other script type languages. According to some benchmarks, Kitura outperforms Node.js hands down.

https://medium.com/@rymcol/benchmar...frameworks-vs-node-js-24460cfe0beb#.4sos6sj8g

One important consideration is about your development environment. You want to setup a system that runs on your development machine as a test server, because by this way, the coding-testing-debugging-fixing cycle would be most comfortable. Once you get a milestone ready and tested, you would deploy the code on the target machine.

I myself do everything including web development in C on a Mac using Xcode, and I deploy the code to FreeBSD machines. I am too old to start with completely new concepts and a new language, however, if I would need to start nowadays, I would look into Swift and Kitura.

With respect to the widgets, you may want to learn SVG. You would design the faces of the widgets using tools like Inkscape, Adobe Illustrator, Affinity Designer, etc., then you would embed them into your HTML pages and update its pointers at the client-side using JavaScript XHTMLRequests().


----------



## Phishfry (Jan 17, 2017)

That is the danger of learning by tutorials. You really don't learn but copy.


----------



## drhowarddrfine (Jan 17, 2017)

obsigna said:


> I myself do everything including web development in C on a Mac using Xcode, and I deploy the code to FreeBSD machines.


Almost the same here. We've been doing this for 13 years but only used Macs for one client. We fell into doing this with a small client who became very, very large which begat another large one but we do the same stuff for our raft of small clients.

Macs are very, very popular among the front end. I agree Swift seems to be taking off but I don't hear about it from non-Apple users.

The framework/library field is tiresome and, in three to five years, whatever you use now will be looked down upon. Now they'll say, if you aren't using React and Angular1/2/3/4, you ain't nothin'. You remember jQuery? Gone. (I may be exaggerating.)  There's a phrase for all this I can't recall. "Framework exhaustion" is what it means.

I only see the popular stuff for PHP frameworks and I don't recall what the Python ones are, assuming there are some.

Can nginx handle it? Of course. We don't use Apache anymore but wouldn't have any problem using it if we had to. Fun fact: nginx was created on FreeBSD and, until a couple of years ago, was always developed on FreeBSD but reluctantly switched to Linux due to developer pressure.


----------



## Phishfry (Jan 17, 2017)

I was thinking about my pipe dream in the wrong way. I really want a GTK+ program for widget control interface and a web interface for simple monitoring.

My worries about GTK+ are here:
https://lwn.net/Articles/691131/

GTK+ does fit in with my C language learning agenda. Is it pertinent?


----------



## Cthulhux (Jan 17, 2017)

Again, I don't think Gtk+ belongs into the web.


----------



## Phishfry (Jan 17, 2017)

I wondered at first if GTK+ was too bloated and also looked at tcl/tk and fltk. GTK+ does offer more features.

I see some hubris about gtk+3.2 offering html5 rendering. Is that worthless or insecure? Where is your beef?

I tried bchs.org 'Hello,haters' demo and found that pledge(2) is not available.


----------



## Cthulhux (Jan 17, 2017)

On non-OpenBSD systems like FreeBSD, the call to `pledge` can be commented out or removed entirely.


----------



## chrbr (Jan 18, 2017)

Phishfry said:


> I wondered at first if GTK+ was too bloated and also looked at tcl/tk and fltk.


Dear Phishfry,
from my experience tcl/tk can not be beaten if you like to have some GUI stuff and fast prototyping. In my opinion python is better with respect to clean code. But I have no idea how people can work with tkinter without having used tcl/tk a long time.


----------



## obsigna (Jan 18, 2017)

I am a little bit confused, on how this thread has evolved.

Phishfry, from your first post and with respect to the title "Web Frameworks", my understanding was (and seemingly, I was not alone) that you were looking for an environment that you can deploy on kind of embedded devices for providing access to its GPIO signals via HTTP(S) to clients in the Web running commodity Web Browsers.

Is this no more your objective? Are you going to install a GUI interface on the device itself? I guess you will have already a lot of fun to get X.org running in a descent fashion. With that in place you could use GTK+, TCL/TK, Qt or other toolkits for providing a GUI on the device itself.

Perhaps with a hell a lot of effort you could display sort of GTK+ screenshots in the web browser of a distant client, however this would for sure not be the most effective way of doing things.

If your objective is still what I understood from your first post, then simply forget GTK+, TCL/TK, Qt in this respect, these toolkits are not useful for providing web access to an otherwise headless device.


----------



## ANOKNUSA (Jan 19, 2017)

drhowarddrfine said:


> The framework/library field is tiresome and, in three to five years, whatever you use now will be looked down upon.



This is actually why I chose not to pursue web development as a career. Watching a new HTML5/CSS/Sass/PHP/Javascript/Node framework pop up every 3 months and see people being jerked around and made to use the latest thing scared me away. I remember being blown away by HAML when I first tried it, only to learn that no frameworks included support for it by the time I learned about it. I realized that doing it "part-time" as I'd planned would still mean spending 15 hours training myself to learn something new that I'd use twice, without being paid for the learning.

My temperament is much better suited to being an historian who kicks back and ponders the changes, than to being a web developer who has to run himself into the grave trying to stay ahead of them.


----------



## leebrown66 (Jan 19, 2017)

I have yet to try this myself, but if C++ is an option for you, wt looks interesting.


----------



## Phishfry (Jan 19, 2017)

I got all excited after doing this tutorial with what you could do with a web program. 80 Lines of python put up a usable monitoring interface.
https://vzaigrin.wordpress.com/2015/02/02/web-control-of-raspberry-pi-gpio-in-freebsd/

So then I wanted to learn a web frameworks.  Then I changed my mind as you see above. I have been poking at gtk2&3 still trying to find a cheap book from this decade. I want a digital dashboard. Maybe some temp readings and voltages. Maybe one day a robot interface.
I envision 3 or 4 mini computers feeding a master node using machine vision, gpio and AI. So I have started with a large RC boat I want to turn into a robot. Get it doing GPS waypoints at first, then add vision and so on. Big pipe dream but hey it's a project. Maybe one day it can check my crab pots!

I am enjoying all the learning the web offers for free.

I actually took a left turn at curses. I am reading the Oreilly curses book from 1986. Did about 30 examples and getting the feel for it. Lots of examples abound. The beauty there is the base system included ncurses so you could really have a minimal system for a real embedded work.
Plus more power to C.


----------



## drhowarddrfine (Jan 19, 2017)

In web development, you would be required to install npm so you can install grunt so you can install Bootstrap to design the front end through a browser with mongoDB as a database to hold your config information in JSON with all that handled by nodejs in parallel with nginx along with three or four other libraries handling something you don't need to know or learn about.

ncurses? Nobody uses ncurses anymore. At least that's what the "experts" on reddit will laughlingly tell you as they downvote you into oblivion and you never get your questions answered.


----------



## Cthulhux (Jan 19, 2017)

Phishfry said:


> I am enjoying all the learning the web offers for free.



No, you won't.



Phishfry said:


> Plus more power to C.



Agreed.


----------



## drhowarddrfine (Jan 19, 2017)

Not to go on and on about this but I'm trying to gain access to some tools on Stackoverflow that require me to gain less than 300 points. I'm in the 10K+ range now and I got their rapidly but, nowadays, I struggle to gain points because almost all the web questions are about Angular and React which I prefer to know nothing about. I used to only get irritated at jQuery questions labeled as "javascript" but it's ridiculous that it seems no one does anything in plain html/css/javascript anymore. I'm starting to wonder if they could if they had to.

I've even read people saying, "No one uses plain CSS anymore" and "No one uses vanilla javascript anymore" as if that were a true statement but I'm concerned that these things are said by kids who really don't know what they're talking about.

I also question, if Angular and React and all that are supposed to be so wonderful, why do people seem to struggle with it so much. I'm pretty sure Angular was created for large web sites but I see people using it for small sites, too.

Why? Probably cause someone on reddit told them so, not because they did their own thinking.

(Someone sent me to a link on reddit this morning and I have zero respect for that Frankenstein's monster, as NPR called it, so I'm in a mood.)


----------

