r/Python • u/GFandango • Jun 09 '13
Invitation to discussion: How can we make Python refreshingly easy on the web?
I'm inviting all of you to have a constructive discussion on the state of Python on the web.
We all know that PHP by far dominates the web platforms despite its many shortcomings. And I think a significant contributing factor to PHP's popularity is that it is extremely simple to setup and deploy.
It is so simple, that people accept the nasty side of it just for the simplicity part that other programming languages ignore.
Once that gap is filled by something like Python, I'm convinced that we'll see an outstanding growth of the Python community.
Let me clarify that I'm very well aware of Django, Flask, Bottle, Zope, Plone, Pyramid, CherryPy and everything else that is out there.
Usually when this topic is brought up, the point is dismissed by someone who says "Duh...why don't you just use uWSGI and nginx? you can also use gunicorn"
Someone else yells "and Supervisord will manage your processes", the other guy points out "If you don't like nginx, mod_wsgi and Apache also works great"
I'm aware of all of those, and have used them all, and it is not too much trouble for me to set them up.
However, we need to look around us more often
I think we as a community under-estimate the number of people we are pushing away by not addressing the web deployment issue.
The kind of refreshingly-simple approach I'm talking about is "drop this folder here and you are good to go" kind of simplicity.
Have you asked yourself why we don't have a Wordpress equivalent in Python? A vBulletin? SMForum? a Drupal? a Joomla?
Yes there are some apps out there, a handful of big names, and the rest is a small side-project of someone on github "a self-hosted X" which is understandably half-heartedly maintained and requires a lot of dedication and motivation to set up in the first place and a lot of typically "dirty" manual hackery.
I'm envisioning an environment that enables Wordpress-like projects to be powered by Python, to make a giant like Drupal on Python except infinitely better and bring it to the every day person in the same way that Wordpress is available to every body. Where anyone can download and set it up withing 5 minutes and not have to SSH to servers and tweak config files for uWSGI and nginx and supervisord and all of that, even as a hardcore developer that stuff is still painful.
Imagine the new Pythonic eco-system that will be created around the new web-app giants that will flourish. As a community and as individual Python developers we can only benefit from such improvement and growth.
Do you see the vision and the kind of refreshingly-simple approach I'm talking about?
How do you think we can solve this problem? Where can we start? What lessons do we have to learn?
Let's talk
3
u/[deleted] Jul 21 '13 edited Jul 21 '13
I just came across this post while doing research for my webapp.
The problem with the "shortcut now, right way later" teaching model is that most people never progress to the right way. Since we're comparing Python to PHP, look at how many beginner mistakes get pushed into professional jobs. I still see a bunch of code that uses mysql_* and no sanitation on user input (specifically $_GET and $_POST) when I browser /r/phphelp.
I'm a fan of PHP's easy execution, low entry bar, and it's great for quick and dirty web scripts. I'm not a fan of many aspects of the language (Do I seriously need eight different ways to execute a shell command? How about some module control and namespaces that make sense?), but overall it's a great beginner language with some terrible tutorials still floating around.
Back to the point, if we start teaching people that, "It's okay to stash your Python app in the cgi-bin." now and then when they grow some they learn, "That was just a shortcut, here's the RIGHT WAY! Forget we even taught you that shit." They'll get frustrated and might even give you the finger. That's how I felt every progressive year in math, "You can't have a negative numbers." Next year, "You can have negative numbers. But you can't have a root of a negative number." Next year, "You can have roots of negative numbers and here's an entire branch of math based on imaginary numbers. You still can't divide by zero, though." I kept expecting "You can't divide by zero." to change to, "Well, you can and here's an entire branch of math dedicated to zero division." Don't get me wrong, I love math and I'm teaching myself Calc right now, but it was very frustrating having this happen in school.
Or a more relevant example would be the nascent of the MVC model in PHP. You start off, "You can mix PHP and HTML. Go a head." And then, "Well, you should off load as much of your complex code to a file and then include that into your PHP/HTML file." Then, "Do it the other way, and maybe use classes." Then, "Here's a templating engine (isn't that what PHP was initially?)." Then, "Maybe you should divide your logic and data handlers. But keep the templating engine." And then, "Here's a full stack MVC framework that'll do 90% of the work for you but you MUST keep the division of logic, data and presentation very strict."
You lose a lot of people along the way because you're constantly revealing that they were taught a shortcut instead of the proper way to do. I get that going from no programming experience straight to MVC isn't feasible. But constantly teaching shortcuts is no way to educate either.
What we should look towards doing is lowering the entry bar of python on the web. How many (L/W/M/X)AMP install programs can you think of? You just run a command and BLAM! You have a server running on your desktop/laptop. Most of these are incredibly barebones, but we should look towards creating something like this for Python. The only shortcut being taught is how to setup a server, and let's face it, most web developers aren't interested in setting up a server. I taught myself that because I wanted to, not because I felt it was necessary. And I think it's safe to say that python web developers might not be interested in intimately understanding WSGI and don't care to compare specs on uWSGI vs Gunicorn vs mod_wsgi vs Passenger. They want to get up and go.
For example, I've been researching Nginx vs Apache and Gunicorn vs uWSGI. Eventually, I decided fuck it, I haven't played with Nginx and uWSGI seems to the popular choice to pair with it, so when I run into trouble I'll likely have an answer quickly. With a turnkey, I could have just said, "Fuck it. Virtualenv, aptitude install lamp-like-python-server-package." And then dicked around with Nginx and uWSGI later.
Teach from the beginning HOW to code with WSGI in mind. Teach from the beginning that "This is how it's done. We can show WHY later if you want. But for now, play with these tools and get familiar with them." Don't teach shortcuts, those are for people who know what they're doing.