Web Application Frameworks: C++ vs Python

守給你的承諾、 提交于 2019-12-04 03:29:27

If you'd like to avoid writing HTML, you could try GWT. However, in my experience, using an intermediate framework to generate HTML and ECMAScript never works anywhere near as well as hand-writing the pages.

[edit] nikow mentions in the comments that Pyjamas is a port of GWT to Python.

Regarding the language, if given the choice between C++ and Python I would pick Python 100% of the time. Even ignoring the obvious difference in abstraction between those languages, Python simply has more useful libraries than C++. You don't have to write your own development-oriented web server -- Django comes with one. You don't need to write a custom template library -- Python has Genshi. Django comes with a capable ORM layer, or for even more control you can use SQLAlchemy. It's barely a contest.

I would go with Wt because:

  • You already know C++
  • It has a nice layout system, so you don't need to know lots of HTML
  • It is very well written and a pleasure to code in
  • Your deployed apps will handle 50 times the load of the python app on less hardware (from experience with pylons apps, 10,000 times the load of a plone app :P)
  • It has all the libraries that the guy in the first question says it doesn't and more
  • Web 2.0 isn't an after thought; it wasn't designed on a Request+Response model like all the python frameworks (as far as I know), but on an event driven interactive model.
    • It uses WebSockets if available
    • Falls back to normal ajax gracefully if not
    • Falls back to http for browsers like linx
  • It is more like coding a gui app than a web app, which is probably what you're used to
  • It is statically typed and therefore less error prone. Does def delete(id): take an int or a string ?
  • The unit tests (on my apps at least) take 10-100 times less time than my python app unit tests to run (including the compile time)
  • It has a strong and friendly community. All my email list posts are answered in 0-3 days.
  • Django is good point to start web development it is great framework
  • If you look for C++ take a look on CppCMS, it is much more close to Django, it is not like Wt that mimics Qt.

In any case, it is really depends on your needs. C++ can be used for embedded or high performance web applications, but for medium range web sites Django would be better. (and I'm developer of CppCMS)

I think you better go firt python in your case, meanwhile you can extend cppCMS functionalities and write your own framework arround it.

wt was a good idea design, but somehow not that suitable.

If you are exploring Python frameworks (based on the excepted answer I think you are) I think you really owe it to yourself to check out CherryPy. When you write CherryPy apps, you really are just writing Python apps. The framework gets out of your way in a real hurry. Your free to choose your own templating, ORM (if you choose to use ORM), etc. Seriously, take 10 or 20 minutes and give it a look.

x10

The only reason you might want to use C++ over Python is when speed is paramount.

If this is going to be your first web-app, you'll probably be ok with just Python, and your development speed will be orders of magnitude better than with CPP.

Django's templating language is far from powerless, to me it actually seems very pythonic. You actually can write pure python in a template(although this is generally not recommended).

Even better, it's possible to replace Django's templating system with the one you like. My personal favourite language for this is HAML.

Here's some data on this: Is there a HAML implementation for use with Python and Django

Having looked several ones, like django, pylos, web2py, wt. My recommendation is web2py. It's a python version of "ruby on rails" and easy to learn.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!