Re: using python in web applications

2011-09-15 Thread Alan Plum

On 2011-09-11 02:50, Littlefield, Tyler wrote:
I replied to that one off list I guess, but I figured Django was way 
more overhead than I wanted, doesn't really fit with solving the speed 
issue.


Depending on your needs, you may find something like bottle or Flask a 
better choice then.


Django can be scaled down a lot, but it's a full-featured framework at 
its heart. Bottle is pretty minimal (IIRC it doesn't even come with any 
templating). Flask is somewhere in between as it bundles Werkzeug (a 
pure WSGI framework) with Jinja (a template library) with some glue code.


I have used Flask in the past but often found myself implementing half 
of Django anyway, which is why I eventually switched. When I only need a 
bare API with no database and without templates, I usually go for Bottle 
these days.


If you feel like coding closer to the metal and care more about 
performance than readability, you might also find Twisted useful.

--
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-15 Thread Roy Smith
In article mailman.1164.1316093103.27778.python-l...@python.org,
 Alan Plum m...@alanplum.com wrote:

 Django can be scaled down a lot, but it's a full-featured framework at 
 its heart.

You can pick and chose which parts of django you want to use.  You don't 
need to use any of the Django model stuff.  You don't need to use any of 
the template system.  You can tear out all or most of the default 
middleware.  At that point, about all that's left is the route parser 
and dispatch code.  The nice thing about this is that as you 
incrementally discover which pieces of it you really do need, it's easy 
to pull them in.

That being said, we've made a lot of use of Tornado for small 
stand-alone web services with just a couple of routes.  In retrospect, 
it's unclear if there's any justifiable argument for why we use both 
Tornado and Django, other than hysterical raisins.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-13 Thread alex23
On Sep 10, 1:54 pm, Littlefield, Tyler ty...@tysdomain.com wrote:
 I'm not feeling particularly masochistic, so I do not want to develop
 this project in PHP; essentially I'm looking to build a web-based MMO.

Google have been promoting the use of appengine along with HTML5  JS
to produce games. One advantage of using GAE to host the server is it
takes care of the scaling for you.

I found these presentations fascinating:
http://cc-2011-html5-games.appspot.com/#1
http://io-2011-html5-games-hr.appspot.com/#1

This article covers the process in a little more depth:
http://clouddbs.blogspot.com/2011/02/how-to-write-html5-game-in-30-days-with.html

Google are also aggregating platform-specific info here:
http://code.google.com/games

Hope this helps (and let us know when you have something to show off!)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-11 Thread Tim Roberts
Littlefield, Tyler ty...@tysdomain.com wrote:

I don't much care for PHP, but the thing that can be said for it is it's 
pretty quick. How does Python compare?

PHP is quick for development, in that you can slap together some schlock
and have it mostly work.  The result, however, is usually schlock.  The
performance of the language itself is almost entirely irrelevant; the
execution time is swamped by the network overhead.

I'm also curious what databases are suggested? I've always 
done most of my work in MYSql, but from what I understand postgresql is 
becoming more popular to.

Well, that's a religious argument.  Personally, I've always been confused
by the draw of MySql.  From the very beginning, Postgres has always been
more powerful, more reliable, more standard-compliant, and more
professional.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-11 Thread Laurent
+1 for PostgreSQL. It's faster than MySQL for years now, and is much more 
seriously featured.
If you don't need ACID properties (transactions stuff) you should also give 
Document-based databases like MongoDB a try. It changed my code life.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-11 Thread hidura
I am agree with postgresql i don' t have any problem, also is better for big 
applications. And Python is always better language than PHP if you' re going to 
create a web app.
Sent from my BlackBerry® wireless device

-Original Message-
From: Tim Roberts t...@probo.com
Sender: python-list-bounces+hidura=gmail@python.org
Date: Sun, 11 Sep 2011 11:48:01 
To: python-list@python.org
Subject: Re: using python in web applications

Littlefield, Tyler ty...@tysdomain.com wrote:

I don't much care for PHP, but the thing that can be said for it is it's 
pretty quick. How does Python compare?

PHP is quick for development, in that you can slap together some schlock
and have it mostly work.  The result, however, is usually schlock.  The
performance of the language itself is almost entirely irrelevant; the
execution time is swamped by the network overhead.

I'm also curious what databases are suggested? I've always 
done most of my work in MYSql, but from what I understand postgresql is 
becoming more popular to.

Well, that's a religious argument.  Personally, I've always been confused
by the draw of MySql.  From the very beginning, Postgres has always been
more powerful, more reliable, more standard-compliant, and more
professional.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-10 Thread Littlefield, Tyler

On 9/9/2011 10:19 PM, Ben Finney wrote:

Littlefield, Tylerty...@tysdomain.com  writes:


I'm curious if there are some good solutions for using Python in web
applications.

Start with:

URL:http://docs.python.org/howto/webservers.html#frameworks
URL:http://wiki.python.org/moin/WebFrameworks



Awesome, will do, thanks.


and try your criteria against what you find there.




--

Take care,
Ty
Web: http://tds-solutions.net
The Aspen project: a light-weight barebones mud engine
http://code.google.com/p/aspenmud

Sent from my toaster.

--
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-10 Thread Laurent
[troll]
For a serious web based MMO you'd rather stick to low level and forget about 
bloated Object Relational Mapping java-like layered kind of frameworks that are 
made for Rapid Applications Development, not for efficiency.
[/troll]

Eve Online, a well known MMORPG was developped with stackless python : 
http://highscalability.com/eve-online-architecture

You mentioned nginx so I can tell you I personally use Linux + nginx + mongodb 
(pymongo) + Python 3 version of cherrypy (with Mako templates) and it's working 
fine after some tuning.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-10 Thread Littlefield, Tyler

On 9/10/2011 5:35 PM, Laurent wrote:

[troll]
For a serious web based MMO you'd rather stick to low level and forget about 
bloated Object Relational Mapping java-like layered kind of frameworks that are 
made for Rapid Applications Development, not for efficiency.
[/troll]

I replied to that one off list I guess, but I figured Django was way 
more overhead than I wanted, doesn't really fit with solving the speed 
issue.



Eve Online, a well known MMORPG was developped with stackless python : 
http://highscalability.com/eve-online-architecture

You mentioned nginx so I can tell you I personally use Linux + nginx + mongodb 
(pymongo) + Python 3 version of cherrypy (with Mako templates) and it's working 
fine after some tuning.


Awesome, thanks. I'm new to this, so some of that flew over my head, but 
I'll take a look at all of them. I'm not sure of the relevance of 
stackless in this case; I was looking into PyPy, but I'm not really sure 
whether that can be connected with nginx. I guess I could just write the 
web server in Python and use it from that point.


--

Take care,
Ty
Web: http://tds-solutions.net
The Aspen project: a light-weight barebones mud engine
http://code.google.com/p/aspenmud

Sent from my toaster.

--
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-10 Thread Laurent
Well PyPy is just an implementation of Python among many others (but limited to 
version 2.7). It is not a web server. If you want to make PyPy interact with a 
web server (such as nginx) you have to use a special protocol such as WSGI or 
Fast-CGI. For best performances you can for instance use uWSGI that integrates 
well with nginx but for this you have to recompile nginx. As you see it's a bit 
complex, you should read the wikis. May the Force be with you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-10 Thread Chris Angelico
On Sun, Sep 11, 2011 at 9:35 AM, Laurent laurent.pa...@gmail.com wrote:
 [troll]
 For a serious web based MMO you'd rather stick to low level and forget about 
 bloated Object Relational Mapping java-like layered kind of frameworks that 
 are made for Rapid Applications Development, not for efficiency.
 [/troll]

I have been trolled. :)

For any sort of web-based real-time game, here's two things to avoid:

1) Snoopability and modifiability of crucial data. Everything should
be stored on the server, so that if anyone fiddles, all they do is
break their own client so it has to reload from the server.
2) Massive waste of resources due to unnecessary frameworks/facilities.

I play a lot of Flash games, and right now I'm playing one that has
coped poorly with a miniature slashdotting. A spike in popularity
resulted in a spike in server lag. I fired up a little packet sniffer,
and discovered that every time you do anything in the game, the client
makes a new POST request to its server. Why?! It's not that hard to
hold a socket connection open!

In another context, a similar issue - not a problem as yet (that I
know of), but would be if the system were to be slashdotted. A server
whose sole purpose is to handle script-instigated requests (using HTTP
POST for its transport) sends back a Set-Cookie header with a session
id. This implies that the server is holding session data for all these
clients that are never going to send that cookie back. The server
appears to be IIS with ASP scripts, so presumably stateful sessions
are enabled by default, so it's costing memory and processing to hold,
then discard, all those useless (and probably empty) session state
tags. And presumably many MANY other servers have the same thing.

What's YOUR framework doing that you don't need, and how much is it costing you?

Yeah, I was trolled bad. :)

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


using python in web applications

2011-09-09 Thread Littlefield, Tyler

Hello all:
I'm curious if there are some good solutions for using Python in web 
applications.


I'm not feeling particularly masochistic, so I do not want to develop 
this project in PHP; essentially I'm looking to build a web-based MMO. I 
know that you can use nginx with Python with servers like Flask, but I'm 
not really sure how well all of those work. Since this will be a game, I 
can expect quite a few users; I've already got quite a lot of interest. 
I don't much care for PHP, but the thing that can be said for it is it's 
pretty quick. How does Python compare? Are there some solutions (I was 
told about PyPy today) that would be quicker that I could still use for 
the web app? I'm also curious what databases are suggested? I've always 
done most of my work in MYSql, but from what I understand postgresql is 
becoming more popular to.


Thanks all for the input,

--

Take care,
Ty
Web: http://tds-solutions.net
The Aspen project: a light-weight barebones mud engine
http://code.google.com/p/aspenmud

Sent from my toaster.

--
http://mail.python.org/mailman/listinfo/python-list


Re: using python in web applications

2011-09-09 Thread Ben Finney
Littlefield, Tyler ty...@tysdomain.com writes:

 I'm curious if there are some good solutions for using Python in web
 applications.

Start with:

URL:http://docs.python.org/howto/webservers.html#frameworks
URL:http://wiki.python.org/moin/WebFrameworks

and try your criteria against what you find there.

-- 
 \ “As scarce as truth is, the supply has always been in excess of |
  `\   the demand.” —Josh Billings |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Using Python for web applications

2010-06-30 Thread Wyatt Schwartz

Dear Python-List members,

Sorry for asking such a simple (or possibly complicated) question, as  
I am new to Python programming. Anyways, I have read online that many  
popular websites use Python for some of their web-based applications  
(for example, Reddit), and that lead me to wonder how is this done?


Thanks in advance!

- Wyatt
 - Beginning Python Programmer
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python for web applications

2010-06-30 Thread Daniel Fetchinson
 Sorry for asking such a simple (or possibly complicated) question, as
 I am new to Python programming. Anyways, I have read online that many
 popular websites use Python for some of their web-based applications
 (for example, Reddit), and that lead me to wonder how is this done?

There are various options, the simplest is using a full blown web
framework which simplifies about 90% of the work and you only need to
code the logic related to your app. Two of the most popular frameworks
are django [1] and turbogears [2].

You can also go more low level by designing your own framework from
scratch which is something the bigger shops are doing like youtube.

In any case there is a wiki page that you might find useful [3].

HTH,
Daniel

[1] http://www.djangoproject.com/
[2] http://www.turbogears.org/
[3] http://wiki.python.org/moin/WebProgramming


-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python for web applications

2010-06-30 Thread Zubin Mithra
On Wed, Jun 30, 2010 at 11:34 PM, Wyatt Schwartz wyattj...@gmail.comwrote:

 Dear Python-List members,

 Sorry for asking such a simple (or possibly complicated) question, as I am
 new to Python programming. Anyways, I have read online that many popular
 websites use Python for some of their web-based applications (for example,
 Reddit), and that lead me to wonder how is this done?

 Thanks in advance!

 I would recommend that you check out the various web-frameworks which are
out there. Django is the framework I use and love, but there are loads out
there.

Have fun!
Zubin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python for web applications

2010-06-30 Thread Mithrandir
Wyatt Schwartz wyattj...@gmail.com wrote in 
news:mailman.33.1277921551.1673.python-l...@python.org:

 Dear Python-List members,
 
 Sorry for asking such a simple (or possibly complicated) question, as  
 I am new to Python programming. Anyways, I have read online that many  
 popular websites use Python for some of their web-based applications  
 (for example, Reddit), and that lead me to wonder how is this done?
 
 Thanks in advance!
 
 - Wyatt
   - Beginning Python Programmer


For something more server side see:

http://wiki.python.org/moin/WebFrameworks

Some nice examples are at: 

http://wiki.python.org/moin/WebApplications

Good luck! :)


-- 
People should read more.
https://secure.wikimedia.org/wikipedia/en/wiki/User:MithrandirAgain
All that is gold does not glitter, 
not all those who wander are lost; 
the old that is strong does not wither,
deep roots are not reached by the frost. 
From the ashes a fire shall be woken, 
a light from the shadows shall spring; 
renenwed shall be blade that was broken, 
the crownless again shall be king.
-- 
http://mail.python.org/mailman/listinfo/python-list