Goal: simple browser app, for navigating files on a web server, in a tree view.
Background: Building a web site as a learning experience, w/ Apache, mod_python, Python code. (No mod_wsgi yet.)
What tools should I learn to write the browser tree? I see JavaScript, Ajax, neither of which I know. Learn them? Grab a JS example from the web and rework? Can such a thing be built in raw HTML? Python I'm advanced beginner but I realize that's server side.
If you were going to build such a toy from scratch, what would you use? What would be the totally easy, cheesy way, the intermediate way, the fully professional way?
No Django yet please -- This is an exercise in learning web programming nuts and bolts.
Goal: simple browser app, for navigating files on a web server, in a tree view.
Background: Building a web site as a learning experience, w/ Apache, mod_python, Python code. (No mod_wsgi yet.)
What tools should I learn to write the browser tree? I see JavaScript, Ajax, neither of which I know. Learn them? Grab a JS example from the web and rework? Can such a thing be built in raw HTML? Python I'm advanced beginner but I realize that's server side.
If you were going to build such a toy from scratch, what would you use? What would be the totally easy, cheesy way, the intermediate way, the fully professional way?
No Django yet please -- This is an exercise in learning web programming nuts and bolts.
Share Improve this question asked Jun 2, 2009 at 20:11 user447688user447688 1- mod_wsgi is not as hard as you might believe. – Ionuț G. Stan Commented Jun 2, 2009 at 20:17
4 Answers
Reset to default 10First, switch to mod_wsgi.
Second, write a hello world in Python using mod_wsgi.
Third, change your hello world to show the results of os.listdir()
.
I think you're approximately done.
As you mess with this, you'll realize that transforming the content you have (information from os.listdir
) into presentation in HTML is a pain in the neck.
You can add Jinja templates to this to separate content from presentation.
Finally, you'll notice that you've started to build Django the hard way. Stop. Learn Django. You'll see that it's still "programming nuts and bolts". It doesn't "conceal" or "abstract" much away from the web server development experience. It just saves you from reinventing the wheel.
If you want to make interactive browser, you have to learn JS and ajax.
If you want to build only browser based on links, python would be enough.
The "totally cheesy" way:
python -m SimpleHTTPServer
This will serve up the files in the current directory at http://localhost:8000/
set "Indexes" option to the directory in the apache config.
To learn how to build webapps in python, learn django.