Could you please tell me, How do I write a basic webpage without using framework like Django, Web2Py and others third party frameworks. Also, I don't like to use CGI for it. I need basic MVC structure with a hello-world web page only.
-
See stackoverflow.com/questions/2276000/… and stackoverflow.com/questions/9979326/…h1py– h1py2014-01-18 10:30:59 +00:00Commented Jan 18, 2014 at 10:30
Add a comment
|
1 Answer
I suppose you mean a http server, because for a webpage only, you'd use html, not python.
I suggest you start with some reading on this page. It's the http server for python. As you want to keep things easy, you probably just want to overwrite the BaseHTTPRequestHandler or the SimpleHTTPRequestHandler classes, especially the do_GET and do_POST methods.
Note that this won't force you to use MVC, that's your own responsibility. You'll need an actual framework if you want to enforce MVC.
5 Comments
abarnert
I have no idea how he's going to create an "MVC structure" this way. (Unless he wants to serve up a pure-client-side MVC app with a static web server, which I don't think is what he's asking for.) It's not just a matter of not forcing MVC, it's a matter of not having anything to enable it. But then I think what he's asking for is silly, so I can't fault your answer for not providing it.
Noctua
@abarnert: Well you just can't get a MVC structure by default without using a framework, it's something you'd have to do yourself. I just 'skipped' that part of the question because as you say, it can't be answered :P
padam gurung
Hey guys, what i mean is just a simple model view and controller folder and with front controller how routing is done in simple manner without using framework like simplest framework like flask. How do you do using wsgi in single page..please tell me that if you could otherwise its ok.
Noctua
@padamgurung: You're contradicting yourself. The thing that divides the folders in MVC and set the routes is called a framework.
padam gurung
No, you don't understand, you can call anything framework if you write some amount of code that is very common in every pages or every project. But, before you expand your code, you need to do basic working model. What i want i now is basic routing done using wsgi of python as an example, if you know, please comment otherwise not.