I am just starting Python and I was wondering how I would go about programming web applications without the need of a framework. I am an experienced PHP developer but I have an urge to try out Python and I usually like to write from scratch without the restriction of a framework like flask or django to name a few.
You can just make the entire thing yourself as a CGI script written in python. On an Apache server you go into the httpd. conf file and add these two lines at the bottom.
So, can you build rich web apps without using frameworks? The short answer is yes. There are plenty of websites out there that are built without using a framework; GitHub and YouTube are probably the most popular ones.
Python can be used to build server-side web applications. While a web framework is not required to build web apps, it's rare that developers would not use existing open source libraries to speed up their progress in getting their application working. Python is not used in a web browser.
The short answer is no, they are not necessary. You can write a site in ruby or Python using several technologies (Rails-like frameworks, Templates or even talking directly with the HTTP library and building the page CGI-style).
WSGI is the Python standard for web server interfaces. If you want to create your own framework or operate without a framework, you should look into that. Specifically I have found Ian Bicking's DIY Framework article helpful.
As an aside, I tend to think frameworks are useful and personally use Django, like the way Pylons works, and have used Bottle in the past for prototyping—you may want to look at Bottle if you want a stay-out-of-your-way microframework.
One of the lightest-weight frameworks is mod_wsgi
. Anything less is going to be a huge amount of work parsing HTTP requests to find headers and URI's and methods and parsing the GET or POST query/data association, handling file uploads, cookies, etc.
As it is, mod_wsgi will only handle the basics of request parsing and framing up results.
Sessions, cookies, using a template generator for your response pages will be a surprising amount of work.
Once you've started down that road, you may find that a little framework support goes a long way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With