

Ask HN: Python web programming without a framework? - dynamic99

I have some experience with Python scripting, but have only created web apps with PHP. I do NOT want to use a framework due to a few problems it may cause. So can I use Python to create web apps without a framework? Is it worth it?
======
venomsnake
Okay - as a person that recently made the transition:

Flask,Jinja2 + bootstrap + learn python functools.wraps

Flask just makes the dispatch and routing. Jinja templates are very close to
smarty. You can make a site runing in a second. Also a benefit of using flask
is that you have ready WSGI app that you can put on gevent or tornado.

If some of your output is prematurely truncated if you are behind HAProxy -
check tornado keep alive settings. (not relevant but took me 2 days to figure
it out)

------
cyberpanther
If you don't want to use a framework then you should use a micro framework
like Flask: <http://flask.pocoo.org/>

This is essentially gives you the tools to get started and not much else. You
don't want to have to reinvent protocols like Wsgi in order to run fast python
code.

------
taddeimania
No its not worth it. The frameworks exist because many smart people agree that
it isnt smart. Also what problems do you think a framework would cause?

------
digitalWestie
Interesting, what problems are you trying to avoid?

~~~
dynamic99
Not _problems_ so to say.

I don't want to have to work around a framework or have one get in the way. I
would rather redo the work, knowing 100% what every line of code in my app is
doing. Plus, large frameworks like Django don't even look like Python at
times.

~~~
grey413
Simply put, python doesn't have any (non-terrible) built-in capacity for
mapping HTTP requests to code like PHP does. At their core, python web
frameworks are all about adding that capacity to the language. Full stack
frameworks like Django go on to add a lot more, but the simpler frameworks are
all about the request to code mapping, like bare PHP is.

If you're intent on understanding 100% of your codebase, you should consider
one of the single-file frameworks, like Bottle or Flask, and spend some time
reading and understanding their code.

