Python program to Website Application
I'm working on a project which is converting a 50mb python Graduated interval recall rating system for pictures and text program to a website based application. (and then design a website around it) It needs to connect to a database to store user information frequently so it needs to be run server side correct? Assuming I know nothing, what is the best structure to complete this? There seem like many different options and I feel lost.
I've been using CGI to create a web UI for the original python code. Is this even possible to implement?
What about pyramid / uWSGI / pylon / flask
or Django? (although I was told to refrain from it for this project)
Well, it may be difficult to give you a good advice because the description of your project is quite vague - what in the world is "a 50mb python Graduated interval recall rating system for pictures and text program"??? :) - but I'll try to outline the difference between the options you're listing:
Django is a sort of an integrated solution - it includes a templating system, an ORM, forms framework and lots more.
Because of the fact that those things are all closely tied together, Django provides some niceties such as built-in admin interface, pluggable apps etc. Which would make kick-starting development of a traditional website easier as you don't need to build those things yourself. For example, to build a blog site with Django, you need to define a database model, a couple of routes, and a couple of views and that's it - you can add and edit blog entries using the built-in admin interface and authenticate using pluggable authentication module.
But there's a price, of course - to ensure all those bits work together, Django to some extent requires you to use technologies provided by Django - i.e., you have to define your models using Django ORM and write templates using Django templates. You can swap different bits for something else, but they understandably would not work well with the rest of the framework - i.e. you can use another ORM, such as SQLAlchemy, to access database, but such models won't work with Django's admin interface.
To some extent, Django also expects a particular structure of database tables (i.e. it expects to be able to create those tables based on models defined in Python code), which would make working with an existing databases more difficult. Also, my understanding it that it expects you to have an SQL database.
So, in my opinion, Django is a very good choice for building a "typical" Django website (it was built for news websites) which could make use of existing plugabble apps and other Django features.
Pyramid, on the other hand, does not require you to use any particular technology for database access - in fact, it does not require you to have a database at all - you can build an application which works with data stored on filesystem, in an object database such as ZODB or some distributed NoSQL storage. Maybe even some XML file and a bunch of images... your imagination is your limit
When using an SQL database, it does not expect the database to have a certain structure. Also, SQLAlchemy, the recommended Pyramid's ORM, is considered to be more flexible and powerful than Django ORM
It does not require you to use any particular templating library or form library, so you can choose whatever suits your needs best.
Pyramid does not even require you to use route mapping with is a cornerstone feature of most web frameworks - in addition to route mapping Pyramid supports URL traversal, which can be a very powerful way to work with hierarchical data structures.
While not requiring you to use any particular technology, Pyramid does provide some sane templates for typical use cases.
The cost of this flexibility is that may be more difficult to find existing "apps" which can be plugged into your very custom Pyramid website without any changes - although excellent WSGI support in Pyramid leverages that.
Pylons is called Pyramid now after the project merged with repoze.bfg some time ago.
uWSGI is more of an application/protocol to serve a Pyramid application (or other WSGI-conformant application)
flask - never used it, maybe someone else will give you some overview.
So, in short, the choice between Django and Pyramid boils down to the question "How much of Django's built-in features will I be able to use on my site" - because if you're not going to use Django's automatic admin or to make heavy use of third-party pluggable apps - everything else is better in Pyramid :)
I have been told that pylons is quite good (newer pyramid), but I personally use Django and I'm quite happy with it. Do not even try to use CGI because that's the same mistake I made - and I figured out later that changing all the html was a pain in the arse.
If the application needs to talk to a database that already exists, then django won't buy you much value IMO. since the admin interface won't work for that part unless the db schema adheres to what django expects (auto increment int primary keys etc...), the same goes for any other webframework that presumes an expected schema.
So then, sqlalchemy is your best bet. It has an orm layer, but you don't have to use it, you can get a lot of bang for the buck just using the query interfaces.
So as far as webframeworks go, that narrows it down to anything that can use sqlalchemy. Which is anything but Django, Zope and probably web2py due to the reasons mentioned above. Though for Zope it's value is somewhat derived from the fact that it's backed by zodb. But zodb is not going to help you at all with your existing database and data.
So out of what is left of the web frameworks, what I would use a selection criteria is what it's abilities are for routing requests to views. And how well it matches your url generation strategy. IMO, pyramid is very flexible in this area. But you might not need that. You may be able to get by with flask or bottle. Or even straight webob.
Another slightly less important criteria is template engine/language, most frameworks will support the more popular ones, such as jinja2 etc...
My personal choice is pyramid because it scales nicely from super easy to super hairy in the request routing department. But again, depending on how you want your urls to work, you may not need that.
Django has a command (./manage.py inspectdb) that can help you make initial models of your current database. If you decide to redesign the database this will still make it easier to move the data into the new schema. Personally, I like Django, but the others maybe very well suited to your application.
To communicate back to the server you could probably use AJAX.
I've found Django too heavyweight for my needs. I've had good success with CherryPy, a minimalist Web Framework