Saturday, February 27, 2010

In developing my site for the cloud I found it a bit of a challenge. There is very little documentation in terms of infrastructure strategy and a lot of sites assume you have a clear methodology. I always strive for a clean infrastructure — having developed code for the quite awhile I have come to know that if you have a solid scalable strategy up front it makes things just work easier later on. That is why I was really turned onto google-app-engine. It gives you a clear way of building and testing your code and then pushing it to the web. It is a great place to start but it isn’t the “everything” I’m looking for. Because some of the limitations/restrictions with using google-app-engine (GAE) you need to understand that if you want to use it (i.e. python package) you need to include it in your application. That is where the benefits of a virtualenv come into play. virtualenv (when combined with pip) let you know exactly what packages you have because throughout the application development process if you need it you ‘pip-it’. Then pip gives you a clean manifest on what you have so you always know. But.. (you knew this was coming) GAE doesn’t like a virtual env. In fact if you try it you almost surely run into problems. For me it was a error along this line...

ImportError: No module named unittest

So what can I do? For me the reasons to use a virtualenv/pip combination is too compelling to simply not use it. I really like knowing what packages I willbe deploying up to the cloud and since I need to package them with my application why not? Furthermore if you are used to running in a virtualenv/pip environment or you have a somewhat stock python environment this is just a good way to keep things straight. Understanding the obvious limitation that you can’t run in a virtualenv we are going to take advantage of everything else this environment has to offer.

General Development Strategy

Use Django. While I understand that GAE now support 1.1 I want that control left to me.

Keep the development tree streamlined for the entire site. Guido recommends (as I understand him in this video ~11:45) to use a single app-engine application per independent application. This doesn’t make much sense to me as the ability to share information between different models is really extending the multi-dimensionality of the site. So my preference is to keep it all under one hood.

Use revision control (for me it’s perforce - I don’t have anything against the others (hg/git/svn) it’s just what I like)

Now open up a web browser to http://127.0.0.1:8000/ and you should get the famous “It works!!”. At this point you should also configure the Google App Engine Launcher to point to your site directory and “www” will be your application.

Build up a quick index and push it to the web.

This is not for the faint. I am going to quickly build up a basic django index page. I want to show it works and we con complete the process.

Shuffle around my tree (personal preference)

Like I indicated above I like to have my apps all under a single apps tree (keep it clean). I also like to put settings.py under a settings tree - this allows me to mess with the __init__.py

10 comments:

The other Python framework that works nicely on GAE is Web2py. The interesting thing is, it only deploys the application code with some supporting libraries by simply running appcfg.py. It is an MVC type framework and works similar to Django.

Appreciated your article. I have one question though:By deactivating your virtualenv before running manage.py test, aren't you using the "main"-python instead of the one in your virtualenv, defeating the purpose of using virtualenv?

NET is a Programme Several vital some piece of what Windows is running in Run On A Present For General k like program. Cloud Development This Cool People What do I need It. NET provision that runs the PC That self-important. For the individuals who created, .NET advancement, ASP improvement, SharePoint advancement, Microsoft advancement, programming improvement, Singapore. Window Phone Apps // iPhone Application Development // Window Phone APPS