Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program web applications in python without a framework?

Tags:

python

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.

like image 806
Dr Hydralisk Avatar asked Feb 16 '10 20:02

Dr Hydralisk


People also ask

Can we create website using Python without framework?

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.

Can you create a web app without a framework?

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.

Can you build a web app with just Python?

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.

Do you need a framework for Python?

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).


2 Answers

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.

like image 174
Michael Greene Avatar answered Sep 25 '22 02:09

Michael Greene


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.

like image 29
S.Lott Avatar answered Sep 26 '22 02:09

S.Lott