I'm tasked to create a simple CRUD MVC application, and I thought it's a good opportunity to learn python. Because of its great documentation, I'm thinking now that I'll go with Django.
Now, this simple CRUD MVC application could become quite complicated in the future. I might have receive and issue JMS messages, display charts that are updated periodically (I'm thinking about ajax) and what not.
Given this I'm a little worried, since while I'm told it's easy to call Java code from python (I'm a Java developer), I'm also told that Django is generally best for content based web application, and can be restrictive.
Do you think it is okay to go with Django in this case?
simple CRUD MVC application
Django does this "out of the box" The admin interface is a simple, CRUD, MVC application. You don't do much programming to make this happen. You create the model. That's it. Use the Django admin for your CRUD application. Done.
I might have receive and issue JMS messages, display charts that are updated periodically (I'm thinking about ajax) and what not.
That's the point. Since you didn't waste time writing the CRUD application, you are able to write the other, more interesting stuff.
Look at http://hjb.python-hosting.com/ for a Python-JMS bridge.
We have FLEX front-end and Django-based RESTful web services. The Django apps create PDF's, and other things. The FLEX does pretty pictures and charts.
Django is generally best for content based web application, and can be restrictive.
Doesn't mean anything. Provide a quote or a link to whatever it is you're talking about.
Mozilla is currently rewriting two of our largest sites on Django. These are both fairly complex applications that interact with numerous online and offline services. With Python's large collection of libraries, anything Django doesn't do itself we've usually been able to find, or create pretty easily. For example, we have both cron jobs and on-demand offline tasks, backed by AMQP, which is similar to JMS.
Short answer: you can get pretty darn complicated if that's what you need to do, and odds are there's already a Python project or library to do what you need.
Related
I'm slightly confused on what is meant by a "web application". I.e. Django positions itself as "a web framework" for the development of "web apps", quite similar to the description of Pyramid. What I'm looking for is a framework for an application that has a browser interface but is very database driven. In short: It's a system that should handle transaction and subscriptions. These transactions are registered through a web interface. The backend consists of XML/JSON feeds of these subscriptions/transactions and an administrative interface to generate statistics and reports. Quite similar to a ticketing/box office system.
Now: Is it a good decision to start out with something like Django/Pyramid even though they seem more focussed on the creation of "websites" rather than (scalable) input/output "applications". Is there any python framework that I'm better of using or are they perfectly suited for the kind of software that I'm describing?
Any help would be greatly appreciated!
I don't know Pyramid at the time of writing so I'll answer the Django part, though I can imagine the answer to apply to Pyramid as well as the distinction between websites and web application is quite vague.
Django is suitable for both websites and web applications: you can create an informative website for your local library as well as an all-in web application with lots of interactive features. Django simply facilitates the creation of the backend of a web system. Both websites and web applications use databases, have caching and can have interactive parts with forms.
It's just that websites are usually just for informing the user (most sites out there) or interacting with others (such as forums). A web application is best described with some examples, such as webmail, administrative interfaces, Google Docs, etc; it serves as a replacement of a desktop application.
From a technical perspective, there's no clear cut thing that separates the world of websites from web applications, it's just a matter of what you create with your web framework.
To answer your question, Django is quite suitable for creating a database-driven web application as it supports multiple databases, caching, autmatic creation and handling of forms, etc. I can imagine Pyramid to be suitable as well but I can't answer that. It's good to explore your options.
I believe that at this point you might want to think more about the overall architecture of your application rather than frameworks. For Example
Single Tier - Just a simple webapp, using simple file or object storage
Two Tier - Webapp + Relational Database. The webapp contains the presentation logic + business logic using MVC principles
Three Tier - Webapp + Middle Tier + Relation Database. In this setting, the Middle Tier will basically contain all the business & processing logic. The Webapp is then just a presentation layer
Once you decide the architecture, you can then start thinking about which framework to use for each of the component of the architecture.
I believe progressing this way will be less confusing and will give clarity of thought.
I'd like to ask you about your experiences in developing facebook applications in Python. Which of the popular web frameworks for this language you think best suits this purpose? I know "best" is a very subjective word, so I'm specifically interested in the following:
Most reusable libraries. For example one might want to automatically create accounts for new logged in facebook users, but at the same time provide an alternative username + password logging functionality. I need authentication to fit into this nicely.
Facebook applications tend to differ from CMS-like sites. They are action intensive. For more complicated use-cases, usually some kind of caching for the data fetched from Open Graph API is required in order to be able to perform some queries on local and facebook data at once (for example join some tables based on friendship relation).
I'd definitely prefer popular solutions. They just seem to be much more stable and better thought through. I've previously developed a facebook application in Grails and I as much as I liked the architecture and the general ideas, the amount of bugs and complication that I ran into was just a little bit too much. Also Groovy is still quite an exotic language to develop in, and this time I'm not going to work on my own.
I'm not new to Python, but definitely new to web development in Python. Though after the experience with Grails and all its twists and turns I doubt Python could really scare me.
I would almost undoubtedly go with Django as the easiest and most popular framework for developing any type of web applications, if there's a need for a full-stack framework.
Specifically, in regards to Django's app universe, it is plentiful with many active applications -- but that has its downfalls too. There's no standard application for any 'one' thing, but there are a few applications that will do basically 90% of all that's needed. Sometimes the code is poorly written, but most of the time, the apps work and do what they are needed to do, so there's almost no need for someone to dive right in to the code.
Narrowing down our options, I have had great luck with Omab's Django-Social-Auth, which was absolutely a snap to integrate. It required 3 variables in my settings.py and I was up and running.
The only issue might be if you do not want to use the django.contrib.auth.User model, but, if you are not thinking about using that, I would think about that decision twice :)
To narrow it down even further, pyfacebook is another option for integrating Facebook. It comes with a djangofb application so it's just drop, add to settings.py and all is well. It even comes with an example Django application as part of the distribution. I've had pretty good luck with this application, but, I still think Omab's much easier to integrate.
Finally, Facebook's own python-sdk is easy to integrate from a raw standpoint, where they just give you access to their APIs using a simple Python API. However, it seems to cater more to the AppEngine folks, so YMMV.
I've used Django for quite some time. As of late I use Jinja2 instead. No particular reason, but it's another option
If you do not want to start on Django now. Try learning Flask(which is comparatively a lot easier to begin than Django) and then start building app with Flask.
I've been learning python for use in ArcGIS and some other non-web applications. However, now that I've taken on building a personal website I am interested in using it for web development (as it is the only scripting language I currently know).
I've noticed that there are a lot of these things called "frameworks", such as Django. From what I understand they are just a collection of packages to save you from re-inventing the wheel but I don't really know how they work.
Furthermore, I do not like GUIs, if I need a framework I would like to find one that could be used through a terminal, starts out simple and can be scaled for more complexity when I'm ready. Any advice or ideas on frameworks and why I would want to use one?
The Python web frameworks have nothing to do with GUIs, and can all be used via the terminal.
The benefits of a framework, as you say, are all to do with making your life easier by supplying the components you need to build a website: the main ones are database interaction through an ORM, a templating system, and URL routing. On top of that, the big frameworks also included optional extras like user authentication, administration interface, and so on.
Personally I like Django, but your mileage may vary: I would say, though, that whatever you do with Python and the web will require some sort of framework, even if it's one of the absolute minimal ones like Flask which basically do just the routing part. There's simply no point in writing all this stuff from scratch when it's been done for you.
I'd second the post above: Django is a great framework and will save you loads of time in the long run.
Pretty much every challenge you'll come across when writing a web application will already have been solved, e.g. How do I send emails? What about an admin interface to edit the data? User security?
In my view picking the best framework is all about the ecosystem around that framework. How well used is it? Is it discussed widely on the internet? Have others encountered, and solved, the problems I'm facing?
In terms of where you start, see the Django Tutorial here:
http://docs.djangoproject.com/en/1.2/intro/tutorial01/
If you think Django offers you too much, I'd recommend that you take a look at CherryPy just to compare the different, and much simpler, approach.
With Python, you've got lots of options. To start, I would recommend looking here -- it explains the basics and provides a fairly complete list of frameworks.
If you're looking for something that starts out simple but can also handle more complexity, then you should take a look at web2py. It requires no installation or configuration, has no dependencies, and includes a web server and a relational database. It also includes an optional web-based integrated development environment and admin interface, but you can work through the terminal instead if you prefer.
It's very easy to learn and was designed for ease of use, faster development, and security. You can get a lot done with very little code thanks to the included scaffolding app along with many sensible default behaviors. As things get more complex, web2py can handle it, as it is a well-integrated full-stack framework with lots of built-in functionality, including a database abstraction layer, form handling and validation, access control, web services, and easy Ajax integration.
Personnally, I don't use any framework, I write either from scratch on BaseHTTPServer, or using WSGI (with mod_wsgi).
It is a bit long to write the skeleton, but I think it is faster (I mean at runtime), there is less constraints, and there is lesser to learn.
Does anyone have experience using Python in different variaty of applications?
A little background - I am a 3D artist in an animation studio. I do programming in PHP and use Zend framework for my personal project. Python has always been a language I wanted to learn because it can be used within many applications our studio is using (3D MAX, MAYA to name a few) My supervisor knew about my web background and wanted me to create a web base time line manager for the company. From the requirement I'm expecting quite a simple backend ... so it might be a good opportunity to finally learn Python. The bulk of the work will be on AJAX for the interactive front end.
So if I learn Python with web application and Django in mind, will that limit my Python skill from applying it to other applications?
a little curious about Django features as well. How well does the framework cover in terms of web application compare to Zend? Our application is pretty basic in the back end and I would love to know if Django will be able to cover them.
authenticate against Windows active directory
quick database update via AJAX interaction (drag and drop time line mostly)
Other basic stuff like discussion forum and directory browsing/file manager
So if I learn Python with web application and Django in mind, will that limit my Python skill from applying it to other applications?
No
authenticate against Windows active directory
Yes. You may need to customize an Authentication Backend.
quick database update via AJAX interaction (drag and drop time line mostly)
Django has nothing to do with Ajax. Use piston to create pleasant RESTful API that Ajax can use.
Other basic stuff like discussion forum and directory browsing/file manager
There are many, many canned applications for Django that you can plug in and integrate.
I love python as a language - but it's not the answer to everything. I know this is throwing mud in a python group, but python has one serious limitation - the rigid source code format.
While going through a django tutorial - I noticed that you cannot insert python source code into a template, and that this was presented as a 'feature' for separating programmers and designers.
I later realized that it's a limitation of django - and any other environment where python source code might get accidentally mangled. This also includes HTML WYSIWIG editors and database based 'manglers' (like Drupal).
In my opinion it's a very serious limitation with no easy cure - especially with the need to use other tools to manage the complexity of HTML / CSS / JavaScript.
I found Django a really good way to learn python. There's very little that's quirky, magical or un-pythonic in the framework. A bit of setup and you're away, writing standard python code.
I have around 2 Weeks of Real development time to churn out a contact database system to replace various spreadsheets and pieces of paper laying around.
Also I need to develop two websites (with dynamic content) and a small AJAXian web service.
I have no experience of rails or django, but I can learn fast.
Both claim to be all about the fast development.
What is it that rails has that django doesn't have and vice versa that would accelerate the development of this application?
Also the contact database benifit more from the admin panel (dj) or the scaffolding of views (ror)?
(there will be a lot of CRUD operations)
The Django admin will generate a CRUD application that you can customize to suit almost any need, from your model definitions. I've used the admin for the main user interface for several projects and can tell you that it is a real timesaver. You don't have to spend any time whatsoever at writing templates or Javascript.
Django also has generic views which can do object detail, list views, update or delete on any model without you worrying about the logic of the app. You just supply the templates, hook into the urls and you're basically done.
For deployment I'd say Django and Rails are now equal. Rails has been painful to deploy, but things have changed greatly.
For a simple contact database the admin might be the biggest difference between Rails and Django. And the fact that you can run your Django project locally, with a real webserver without any configuration ('python manage.py runserver').
unless you are exactly equally experienced on both, you should definately use the one you are most comfortable in. If you don't know any python and you don't know any ruby, then you probably shouldn't use either. If you know PHP, you can get similar results with CakePHP or CodeIgniter. If you another language, you can ask about a Rails like MVC framework for that language on this website
Without experience in either one, with only two weeks to deliver a product, I would choose neither. If you have limited time, you need to leverage what you already know. It would take you two weeks just to get comfortable in either environment. Rails and Django are both popular and make it easy to accomplish a lot with a little time because of the number of details that are done for you in the background, without you having to think about it. If you don't know what those details are, you're not going to be able to leverage the power of either platform, and you're going to end up with a codebase that is a tangled mess of code that you don't need and is going to impact maintainability.
I do take issue #knutin's comment about the ease of deployment with Rails. That might have been true a few years ago, but today a Rails app is pretty easy to deploy even on a naked server, and if you plan on deploying on heroku its even easier. As far as I know there isn't a platform for django apps that offers anything like the scalability or ease of deployment that heroku and rails offers.
if you're dead set on doing one or the other, I'd recommend rails with the use of formtastic for generating your CRUD forms. Formtastic offers far more flexibility than the built-in Rails scaffold generators do, so you can go back and make things better while still using them.
Lastly, if you're determined to use something despite a learning curve, I've heard a lot of good things about hobo though I haven't yet used it on a project. You may find it easier to get started with than straight-up Rails.
This article has a good comparison, involving two developers without previous experience with either framework: https://docs.google.com/View?docid=dcn8282p_1hg4sr9
This is a question I still am trying to find the answer too, here is what i can tell you so far.
Preface
When it comes to scripting langauges I always prefer python, not only I feel more strong using python, but also the libraries are better and work faster. Also (and ruby devs will have something to say) I find Python a more understandable and readable code that Ruby.
Said this, Rails is an excellent framework! It has a lot more "magic" that Django, and now with Rails 3 you can write your ajax in unobtrusive Javascript which makes it beautiful to read. Also the path and form features are far better that Django's.
The big problem is this: As I said Rails does a lot for you (aka magic), the only problems is that if you want to escape those conventions for some reason you find yourself dealing with lots of problems, while with Django you have more control over your application.
Django also has the super-hardcore Admin and User application, no need to install any plugin, this is ALL done for you! Setting up users is incredibly easy and the Admin backend gives you CRUD for every model.
Overall I prefer Django, I understand it better and it does what I say, although I must say that, as far as things are going nowadays, Rails will have more support in the future.
Feel free to ask any question!! Hope it helped
Dan