Re: Which Python Framework for REST API and Facebook Wrapper?

2013-09-30 Thread waynejwerner
On Saturday, September 28, 2013 11:20:21 AM UTC-5, [email protected] wrote:
> I will be designing a REST based API for a cross-platform back end that will 
> serve both desktop Facebook users as well as mobile users. It will handle 
> operations such as user creation, retrieval of user and other data, payment 
> verification and in the case of the desktop side, handle the html/css 
> template customization. The database back end is MySQL and I do need a cache 
> system.
> 
> 
> 
> Currently we were using Codeigniter (PHP) for our codebase but as CI seems on 
> the way out, I do not wish to start a new project based on it. I was looking 
> at Laravel for PHP, but, Python is very attractive to me as a language and 
> since the introduction of WSGI, I am confident it can make a difference in 
> performance and code maintainability over PHP while being able to plug in to 
> our dedicated server infrastructure. 
> 
> 
> 
> Since I am not experienced with Python frameworks (though learning curve is 
> not much of an issue for me) I look to the community to understand which 
> Python framework can rival or surpass Codeigniter in terms of performance in 
> heavy traffic backend solutions (over 1M requests per day, with up to 100 
> req/sec at peak). I really want to make the switch from PHP to Python as I 
> believe that Python can solve more problems with less code and faster 
> execution time, not to mention freedom from brackets and semicolons.

If you're looking for something simple, there are solutions like Flask (my 
favourite), CherryPy, Bottle, and web2py. (I only know the names of the last 3) 
I recommend taking a look into the likes of Flask, if only to familiarize 
yourself with some of the techniques of Python frameworks. Here's a basic Flask 
app:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def main():
return "Hey, I'm in a Flask!"

if __name__ == "__main__":
app.run('0.0.0.0', port=5000, debug=True)


If you're looking for performance, Tornado 
(http://www.tornadoweb.org/en/stable/) I've heard is pretty awesome - though 
I've not put it through the paces myself.

HTH,
-W
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CRUD library

2013-09-30 Thread waynejwerner
On Monday, September 30, 2013 5:14:28 AM UTC-5, AdamKal wrote:
> Hi, 
> 
> 
> 
> Do you know any library or framework that unifies CRUD somehow. 
> 
> Maybe I'll describe my problem:
> 
> 
> 
> I have a application that uses many external services and processes them 
> together. This are things like web services and DB and so on. In the REST era 
> we usually operate on object and collections of objects (like in django's 
> ORM) but have different source behind them. My idea was that there might be 
> somewhere a unified abstraction layer that would require from programmers to 
> write the CRUD methods and handle object creation and management (maybe even 
> relations?) by itself. 
> 
> I've started to work on my own library for that but I wouldn't like to do 
> something that someone has done already. 
> 
> Do you know any such library/framework?
> 
> Do you think that it makes any sense at all?


Does http://python-eve.org/ look anything like what you mean? Or perhaps 
http://www.sqlalchemy.org/ ?

HTH,
W
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Do I really need a web framework?

2013-09-30 Thread waynejwerner
On Monday, September 30, 2013 2:57:08 PM UTC-5, [email protected] wrote:
> I want to set up a very simple website, and I need to know if it is necessary 
> to use a web framework (e.g. Django) to do basic interactive operations such 
> as receiving input from the user, looking up a database and returning some 
> data to the user.
> 
> I know that this is exactly the purpose of web frameworks, and that they work 
> fine.
> 
> However, I read somewhere that for small projects such operations can be 
> managed without a web framework, just by using Python with mod_python or with 
> the CGI module. Is this correct? 
> 
> 
> 
> What do you suggest, keeping in mind that I am a newbie and that my website 
> project would be very simple and very small?

If it's small you want, Flask has worked quite well for me. Here's an example:


from flask import Flask, render_template, redirect, request
from  import save_data, get_data
app = Flask(__name__)

@app.route('/')
def main():
return render_template('index.html')


@app.route('/data', methods=['GET', 'POST'])
def data():
if request.method == 'POST':
save_data(request.form.get('data'))
else:
return render_template('data.html', data=get_data())


It doesn't take much to tack SQLAlchemy on top of that for data access, and a 
couple hundred lines will give you quite a lot of power.

HTH,
W
-- 
https://mail.python.org/mailman/listinfo/python-list