Google app engine, multiple languages - python

i'm working on on a project with DJango but i'm also thinking about going the Jython route. By doing so...since i'll be using the java instance instead of cpython wouldn't I be able to use java, scala, ruby and other other languages that run on top of the jvm if need be?

Scala works on GAE.
So does Ruby.
If you want to know about other JVM languages, google search for google app engine followed by the name of the language of interest.
Also see this page.

I'm not sure how good the Jython Java Interop is. But with Clojure you can generate Java classes pretty easy if it is nessesary (not sure). Clojure is really good for GAE.
There are nice librarys, blogs and applications. Like a DSL to work with the Datastore.
Librarys:
http://github.com/smartrevolution/clj-gae-datastore
http://github.com/r0man/appengine-clj
Look at this blog:
http://elhumidor.blogspot.com/2009/04/clojure-on-google-appengine.html
http://compojureongae.posterous.com/
http://www.hackers-with-attitude.com/
This is written in Clojure with the GAE:
http://the-deadline.appspot.com/

Related

Is it possible to use different technologies in one website

I was watching the tutorials for python and the guy told that he coded the Address books and spell checker for yahoo mail in python.
Now initially i was thinking that if i build the website then i have to use one language either php or java or asp or anything.
But i am confused how can we make make separate modules in diff languages and combine to make one website
Any ideas
Phisical architecture of web application can be different from the logical one visible through browser. Basically it is achieved by putting front web server (think of apache with mod_proxy, but it can be any other moder web server supporting reverse proxying) and mounting web application servers (java/python/whatever) to different paths (like /app1 for java app, /app1/subapp for python app, /app2 for php app). Of course those applications work independently by default, so if you want to pass some data between you have to establish some communication between (direct socket-to-socket or indirect with some messaging middleware or database).
In general it is very broad topic, so if you're interested, try with some basic keywords: application servers, load balancing, reverse proxy, url rewriting.
You can use any language to provide a web service, so you can for example provide a REST/SOAP web service that returns JSON or XML. The web service can be written in any language, and the language used to interact with the web service can be any language, as all languages nowadays have JSON and XML parsers.
You can setup different subdomains to be used by different servers and setup those applications in any language you'd like.
I know in Ruby on Rails, you can execute bash commands.
Example: puts ls
If you just need to call simple scripts from PHP, you can of course use exec(). I use it quite often to be able to code something in ruby, which I prefer for non-web tasks, and call the ruby script from PHP (it can of course be done the other way round).
If they're different pages, they can easily be created by different software. So if a mail application written in Java offers a link to an address book, the address book can easily be Python--that's just a matter of configuring the server.
If you need an addressbook component within the mail application, that's a bit more complicated, but still doable. Especially with Java and .NET it's possible to run various languages on the same platform (e.g. Jython and Ironpython run Python on the JAVA and .NET VMs respectively).
But i am confused how can we make make separate modules in diff languages and combine to make one website
Please read this: http://httpd.apache.org/docs/2.0/sections.html
Then read this: http://php.net/manual/en/configuration.changes.php
Then read this: http://code.google.com/p/modwsgi/
Then read this: http://www.modruby.net/en/
Then read this: http://tomcat.apache.org/
Apache can support a large number of languages via plug-in modules.
Using mod_rewrite as well as the fundamental "section" definitions available in Apache, you can separate your URI's into separate modules in different languages.

nagare framework on gae?

anyone using nagare framework on google app engine ?
it seems interesting, but i could not find any documentaiton on how to use it on
google app engine, as it uses stackless python.
so any chances of its running on google app engine ?
also, how stack less python differ from normal python ?
thanks.
links :
Nagare Framework
Stackless python
I currently have a not-yet-released, prototype version of Nagare for GAE (you can see the canonical Counter example at http://nagareproject.appspot.com/)
Here are the 3 Nagare components not working on GAE, with their workarounds in this prototype:
Stackless Python:
Problem: GAE is only pure vanilla CPython
Solution: well, use only pure Python
Limitation: in Nagare, Stackless Python is used to obtain continuation objects. Without Stackless, we lose the call()/answer() feature of Nagare. But note that call()/on_answer() is still working.
Lxml:
Problem: C module not accepted on GAE
Solution: HTML generation rewrote using only ElementTree
Limitation: no more advance Lxml features like XSL or complex XPATH expressions
PEAK-Rules:
Problem: standard AST tree management removed on GAE
Solution: rules management for HTML/JS generation rewrote
Limitation: the security and URL dispatch rules must be written by the developer without the help of generic methods
So, this version of Nagare is pretty much working fine on GAE. And I dare to say that, even with these limitations, Nagare still stay on GAE a better programming environement than the others Python frameworks.
If you want to test it, send a message in the Nagare users group or send me a personal mail to alain.poirier at net-ng.com
If it has a hard dependency on Stackless, it won't run on AppEngine. AE has its own Python runtime. If it doesn't leverage any of Stackless's non-standard extensions to Python, it might work, but I'd say that your chances aren't very good that it would just work.

Best Twitter Framework for Python on App Engine?

I'm looking to incorporate twitter API features into an app engine project that I'm working on.
I'm relatively new to both app engine and python, so I'm wondering what modules/frameworks I should use to most easily incorporate twitter, and to facilitate twitter oauth?
I've seen:
python-twitter
tipfy
gaema
I heartily recomment tipfy, but, as its author #moraes just said, it is its own, little, lightweight framework -- integration with others is possible (through WSGI middleware concepts), but your life is much simpler if you stick with a single framework, and django is much richer (and, of course, much bigger and less simple -- those are two sides of the same coin;-) and very very popular.
I personally like the "very lightweight" approach of tipfy (and WSGI, and Werkzeug, on which it relies), but if you have to pick one single framework for a wide variety of uses, you could surely do much worse than going with the most popular one, that is, django (e.g. as this post suggests).
python-twitter is the strongest library for a do-it-yourself approach. You implement the API in your framework of choice. It is well-maintained code.
tipfy ported the TwitterMixin from Tornado, so you don't need to care about many implementation details. It is probably easier to get something done but it is integrated to tipfy, so you can't really use it as a library for other frameworks. Auth example is here.
gaema is also ported from Tornado, but it is unmaintained.
Theres also tweetapp, but the repository says that it is also not maintained.
Other frameworks may have similar helpers (or you can use a OAuth library).
Disclaimer: I'm author of tipfy and gaema.
I recommend using: Tweepy. There is an example app here: http://github.com/wasauce/tweepy-examples
Tweepy is under active development so I think it will serve you well.
I'm really liking Python Twitter Tools but I haven't yet incorporated it into an App Engine app. Will be soon though. Tweepy is next on my list to checkout.

Good resources to start python for web development?

I'm really interested in learning Python for web development. Can anyone point me in the right direction? I've been looking at stuff on Google, but haven't really found anything that shows proper documentation and how to get started. Any recommended frameworks? Tutorials?
I've been doing PHP for 5 years now, so I just want to try something new.
Django is probably the best starting point. It's got great documentation and an easy tutorial (at http://djangoproject.com/) and a free online book too (http://www.djangobook.com/).
Web Server Gateway Interface
About
http://www.wsgi.org/en/latest/index.html
http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
Tutorials
http://webpython.codepoint.net/wsgi_tutorial
http://lucumr.pocoo.org/2007/5/21/getting-started-with-wsgi/
http://archimedeanco.com/wsgi-tutorial/
There are three major parts to python web frameworks, in my experience. From the front to back:
Views/Templates: Application frameworks don't function as independent scripts - instead, you map paths to python functions or objects which return html. To generate the html you probably need templates (aka views). Check out Cheetah.
Application framework/Server: There are plenty. CherryPy is my favorite, and is good for understanding how a python application server works because a) it's simple and b) unlike django and others, it is just the application server and doesn't include a templating engine or a database abstraction layer.
Database layer: I've actually never used it, but everyone seems to like SQLAlchemy. I prefer, in simple applications, executing SQL directly using a tool like psycopg2 (for postgres).
You can try Django. It's easy to learn, and it works with GAE (though the default version is 0.96, a little bit old, but you can change it). And there's a video about rapid development (by Guido Van Rossum) that goes through the basics of setting up a Django project in App Engine.

What is a good reference for Server side development?

I am more interested in the design of the code (i.e functional design vs object oriented design). What are the best practices and what is the communities thoughts on this subject?
Not that it should matter, but I am working with Apache and Python technology stack.
If you are using Apache+Python, this sounds like you are using Python for dynamic web pages. In that case, I would strongly urge you to look into Django. There are also other Python web development environments, but Django is perhaps the most popular; and it has excellent documentation such as The Django Book. The Django Book describes best practices for setting up a robust web site: how to use multiple servers for redundancy, how to set up the database server, how to set up a cache to reduce the load on your database, etc.
Other than that tip, good Python server-side code would be just good Python code. There was a question asked recently about how to become a good Python developer, and I would suggest you read that: How do I get fluent in Python?

Categories

Resources