0

I started web development 2 weeks ago using GAE,WebApp2,Jinja2 and WTForms.

I read though several articles , discussions , watched lessons about web development with gae (udacity) and started a small project.

Now I am very inexperienced in web-development and I don't know which path i should choose.

.

.

The last few days I poked around with GAE and webapp2. It was very easy to use. But I have to say that i only used webapp2 has a request handler. (post / get)

For templates I took Jinja2 which was self explanatory too.

.

.

Now Steve from Reddit said that it's always better to use a lightweight framework instead of a very big framework because you have more control and you can scale a lot easier.

But I still want to investigate Django-nonrel. I know that Django is limited in GAE.

But to be honest I don't even know what Django does for me, (compared to WebApp2 with Jinja2)

Now to my questions:

Would you recommend a beginner to have a look into Django ? And if I am more experienced => replace some Django code.

Stick to WebApp2 + "some template engine" ?

.

.

PS: I don't ask which framework is the best, I just want some points for consideration.

4

3 に答える 3

4

The short answer is you can probably go either way, there will be some pros/some cons, but I don't think either is pure win.

Here's some pros for using Django-nonrel as a newb:

  • The django docs are generally pretty good. So it helps you get up to speed on some best practices
  • CSRF protection
  • Form validation
  • sessions
  • auth
  • i8n tools
  • You spend less time putting various basic pieces together, django has quite a lot for you.
  • You can potentially save time on stuff like FB/Twitter auth, since there's third party django packages for that.
  • Tastypie is a good rest api package, though you probably don't need it with the new Endpoints
  • The django test framework is great, though the Django 1.4 live test framework (which is even greater) doesn't work for App Engine. I just discovered that yesterday and am trying (so far fruitlessly) to hack it to work.
  • django has a simple tool for dumping the DB to json.  This is pretty useful for testing purposes, for loading/saving fixtures.  You'll have to figure out a way to do this yourself otherwise.

cons:

  • Django-nonrel isn't the latest and greatest. For one, you won't have ndb benefits.
  • While django docs are great, django-nonrel docs are not, so you'll have to figure out the setup part. I've been meaning to do a writeup, but haven't had time.
  • Time spent learning django could just as well be spent learning something else, but I think django probably takes less time to learn than a few different pieces.
  • Some people have said django is overweight and takes much longer to load. django-nonrel includes all the django-contrib addins. I've removed many of those and have had no load time problems. (fingers crossed)
  • There's prob more people using webapp2+jinja, I don't see too many separate individuals chiming in on django-nonrel specific issues, though the ones that do have been very helpful. On the other hand, if you run into a generic django problem, there's a lot of django users.

One thing I can say though, is if you've written for django, it's hard to move away from it piecemeal. You'll have to have replaced all the pieces that you're using before you can get rid of it, otherwise, you'll still have to include most of the package.

An alternative to using django that I know of is gae-boilerplate. It tries to do the same thing but with various different pieces. It still needs a good testing framework though imo.

于 2012-07-12T20:44:59.013 に答える
4

If you are interested in webapp2 (lightweight, official google app engine framework for python 2.7), I recommend you start with a boilerplate or an example project. Personally I recommend https://github.com/coto/gae-boilerplate. I looked around and I think its the most comprehensive, actively maintained, and up to date webapp2 boilerplate right now.

The boilerplate project helps jumpstart more traditional websites and webapps but i think its worth a look even if you wanted to work on something less traditional like a webservice or online api.

And if there are one or two features missing you can always add them to the issues list or contribute them yourself as I did. Flask Engine mentioned above is a good alternative for the flask route.

于 2012-07-16T00:55:52.893 に答える
2

I'll address your second question/part, about whether or not to use webapp2 or other template framework. I'm in a similar position, learning Python and GAE while coding a personal project and looking for a code base that makes it easy to learn, extrapolate, and be highly efficient in terms of using the GAE environment. I've not tried webapp2 but found another framework that might be worth a look. Your mileage will vary, of course.

Specifically, I found Flask-Engine on GitHub as the framework and PyCharm as my editor. Flask-Engine can be found here:

https://github.com/zachwill/flask-engine

PyCharm can be found here:

http://www.jetbrains.com/pycharm/

Flask-Engine includes Flask, HTML5Boilerplate, and a number of other useful tools all integrated. As well as a simple To Do app and email page. It's fairly easy to go into the code to understand where to add your code. It also includes all GAE configuration files to make Flask and other tools work. I found it turnkey: I uploaded the files to an empty folder, added a project in PyCharm, and called up a web browser.

The only inscrutable issue I found with Flask-Engine is that, on a Mac OSX (Lion) at least, the setup code wasn't precisely accurate: you download the template code to an empty project folder. The setup code says you download the files to a project; that approach didn't work for me until I added the empty project folder path to the command line. Then you add a project in PyCharm (and GAE App Launcher) that points to your now filled project folder.

For Python, PyCharm turns out to be highly useful in that it provides tools for GAE projects as well as with Django as well as a full suite of debugging tools. I found the $99 personal license to be okay. There's a 15 or 30 day free trial. I tried Eclipse but found it too complicated. Certainly there are other great IDEs around.

于 2012-07-13T15:36:34.570 に答える