Python web development - with or without a framework [closed] Python web development - with or without a framework [closed] python python

Python web development - with or without a framework [closed]


The command-line Python, IMO, definitely comes first. Get that to work, since that's the core of what you're doing.

The issue is that using a web framework's ORM from a command line application isn't obvious. Django provides specific instructions for using their ORM from a command-line app. Those are annoying at first, but I think they're a life-saver in the long run. I use it heavily for giant uploads of customer-supplied files.

Don't use bare CGI. It's not impossible, but too many things can go wrong, and they've all been solved by the frameworks. Why reinvent something? Just use someone else's code.

Frameworks involve learning, but no real "overhead". They're not slow. They're code you don't have to write or debug.

  1. Learn some Python.

  2. Do the Django tutorial.

  3. Start to build a web app.

    a. Start a Django project. Build a small application in that project.

    b. Build your new model using the Django ORM. Create a Django unit test for the model. Be sure that it works. You'll be able to use the default admin pages and do a lot of playing around. Just don't build the entire web site yet.

  4. Get your command-line app to work using Django ORM. Essentially, you have to finesse the settings file for this app to work nicely. See the settings/configuration section.

  5. Once you've got your command line and the default admin running, you can finishthe web app.

Here's the golden rule of frameworks: It's code you don't have to write, debug or maintain. Use them.


You might consider using something like web.py which would be easy to distribute (since it's small) and it would also be easy to adapt your other tools to it since it doesn't require you to submit to the framework so much like Django does.

Be forewarned, however, it's not the most loved framework in the Python community, but it might be just the thing for you. You might also check out web2py, but I know less about that.


Depends on the size of the project. If you had only a few previous php-scripts which called your stand alone application then I'd probably go for a cgi-app.

If you have use for databases, url rewriting, templating, user management and such, then using a framework is a good idea.

And of course, before you port it, consider if it's worth it just to switch the language or if there are specific Python features you need.

Good luck!