I am a web developer working mainly with C# on ASP.NET (Webforms and MVC)..
I have worked previously with PHP and Other Frameworks and languages of the sort..
I am currently looking and focusing all my development on 2 platforms..
One Proprietary and Industry Class Framework (ASP.NET MVC)
and
One Opensource and Free Framework (Insert framework of choice here)
I have no experience with python or ruby but would like to learn one and use either django or rails..
While i understand both are very different from ASP.NET please advise me which one would be the smoothest transition.. (or the one most worth the migration pain is better!)
Thanks
Daniel
I've been learning rails and loving it. The pain point with it is the documentation - version 3 of rails has just come out, and not all of the documentation you will come across will be up to date. However, you can pretty easily get by.
That said, I'm loving it. Ruby is a very elegant language. You can get a feel for rails by reading through this guide:
http://guides.rubyonrails.org/getting_started.html
I did ASP, then PHP, now ASP .NET for the last 5 years, dabbled with Python now I'm doing some RoR. Don't learn something 'similar' just to get outside of the MSFT stack. Check out Ruby on Rails, it's a different mindset, and you will learn a new way of thinking about a lot of things that will make your ASP .Net code better.
For me Python / Django felt much better and easier. Less magical, but Ruby on Rails is pretty amazing and has a lot going for it.
I would suggest you check out www.tekpub.com where Rob Conrey a MSFT .Net guy does a ton of tutorials including video tutorials on RoR 3.
With open source frameworks, I would choose between RoR and Django. Just stay away from anything PHP-based.
First, I would say learn the base language first, to an extent, and go with the framework built on the language you prefer. For example, I do django because I learned python, not ruby. I tried ruby when I was hired for a rails project (for frontend work, but nevermind), and it just felt too... "fluffy" for my taste.
Second, there's the issue of documentation. Django's docs are always up-to-date (keeping them so is part of the django development process) on 99% of topics you would want to look up, and are fairly easy to follow once you get the basics. The other 1% of things you would want to look up are generally completely undocumented, derivable from the source or else not possible (often possible with a third-party app, though, which are easily found). I can't speak too much for rails, but I was able to find little usable documentation in my short foray into it; perhaps I'm just too used to Django's docs.
Finally there's the development environment -- you're likely to have multiple projects on one machine, possibly with conflicting dependencies. With django/python, you get virtualenv and pip as part of the python dev process (or at least you should). These tools work very well for setting up secluded environments for separate projects. Ruby doesn't have any standardized tools for this purpose, but there is a gem called sandbox that worked well enough toward this purpose when I used it; IMO though, it seems as if it has to fight against ruby's natural behavior to get the concept to work. It looks like it hasn't seen active development in a couple years, unfortunately.
Other factors to consider include mass of third-party apps for a framework and size and attitude of the community behind a framework. In the end, though, I guess it comes down to your comfort level among the languages you know and personal preference.
And I will freely admit that I'm rooting for django.
I am a .NET guy and also worked on PHP for a couple of months. At present I am learning Ruby and after completing basics, I am going to move on Rails.
I would suggest you to go with Ruby and than Rails. Career-wise also, Ruby guys are in demand these days, at least in my country.
For a .Net developer try to start with www.pradosoft.com/ prado framework,
it's PHP framework which looks exactly like ASP.NET ..
try it
Related
I am newbie to the Django framework. I want to learn it and use it to develop applications. I am new to python. To learn Django, do I need knowledge of python and design patterns?
I don't know whether I should learn the design patterns, e.g. MVC, and think about writing applications or instead start to learn the language by writing complex web applications. Your suggestions are welcome.
I'd suggest learning the basics of Python and at least the MVC design pattern first.
From there, yes, go ahead and starting creating a project in Django, it's the best way to learn Django.
As far as "python fundamentals" that means the obvious basic syntax and keywords. From there, it's more important that you understand "programming in general" especially the Object-oriented programming paradigm.
Jump right in to Django. You can do it, and learn as you go. Djangobook will teach you the foundations of Django to start building apps.
One of thing to keep in mind as far as Python itself goes is using PEP8 to style your code, it'll make it easier down the road when others are looking at your code, whether for help or when working on projects.
#S.Lott is right, foundations are important
However, I think it's possible to learn the foundation while building an actual project/app and having some fun/gaining some experience at the same time.
(note: such as the provided tutorials from django, like the poll app)
Edit: I'd like to point out that in the comments below, I no longer support my answer for this particular situation. If the person is experienced with programming and language fundamentals, to me they have the knowledge necessary and the language is merely the tool they use. If that is the case I don't see anything wrong with picking up some of the specifics of a language while using a framework.
What do you term as python fundamentals
How's about the Python tutorial?
I would suggest MDN Django tutorial. In this tutorial you will develop a simple local library app and deploy it on heroku. You will get a good idea on how to develop a web app and deploy it on a cloud platform.
I need to write a basic website on Dreamhost. It needs to be done in Python.
I discovered Dreamhost permits me to write .py files, and read them.
Example:
#!/usr/bin/python
print "Content-type: text/html\n\n"
print "hello world"
So now I am looking for a basic framework, or a set of files that has already programmed the whole registration to be able to kick-off the project in a simple way.
By registration I mean the files to register a new account, log in, check the email (sending a mail), and edit the user information. All this possibly using MySQL.
Let me share my own experience with django. My prerequisits:
average knowledge of python
very weak idea of how web works (no js skills, just a bit of css)
my day job is filled with coding in C and I just wanted to try something different,
so there certainly was a passion to learn (I think this is the most important one)
Why I've chosen django:
I've already knew bits and pieces of python
django has excelent documentation, including tutorial, which explained everything
in very clear and simple manner
It is worth to read complete manual first (it took me two or three weekends. I remember I could not remember/understand everything at first pass, but it helped me to learn where
the information can be found when needed. There is also another source of documentaion
called djangobook. Djangobook contains same information as manual, but things are explained more in detail. It's worth to read it also, it helps to catch up with MVC concept, if you have not tried that before.
And finally to answer your question best: there are already also OpenId modules ready for you. I'm considering to use django-authopenid for my new project. It supports OpenId, while providing fallback to locally managed users.
There is certain learning curve if you are going learn django. The more you know about the web and python the steeper the curve is. I had to also learn bits and pieces of javascript and it took me also some time. If you are able to spend full time learning django, then
you can expect you'll be able to deliver first results within 4-6 weeks. It took me 6 months, since I was doing my django studies in free time.
There are several blog entries &c pointing out some problems with Python on Dreamhost and how to work around them to run several web frameworks that could suit you. (Most of the posts are over a year old so it may be that dreamhost has fixed some of the issues since then, of course, but the only way to really find out is to try!-).
Start with this page, dreamhost's own wikipage about Python -- at least you know it's quite current (was last updated earlier today!-). It gives instructions on using virtual env, building a custom Python &c if you absolutely need that, and running WSGI apps -- WSGI is the common underpinning of all modern Python web frameworks, including Django which everybody's recommending but also Pylons &c.
Some notes on running Pylons on Dreamhost are here (but it does look like Dreamhost has since fixed some issues, e.g. flup is now the dreamhost-recommended FCGI layer for WSGI as you'll see at the previously mentioned URL) and links therefrom. If you do go with Pylons, here is the best place to start considering how best to do auth (authentication and authorization) with it. I'm trying to play devil's advocate since everybody else's recommending django, but for a beginner django may in fact be better than pylons (still, spending a day or so lightly researching each main alternative, before you commit to one, is a good investment of your time!-).
For Django, again there's an official dreamhost wiki page and it's pretty thorough -- be sure to read through it and briefly to the other URLs it points to. The contributed auth module is no doubt the best way to do authentication and authorization if you do decide to go with Django.
And, whichever way you do choose -- best of luck!
django framework
You can try starting with django-registration.
EDIT: You can probably hack something up on your own faster than learning Django. However, learning a framework will serve you better. You'll be able to easily ask a large community when you have problems, and build on work that's already been done. And of course, if you're doing something new in the future, your knowledge of the framework can be more easily reapplied.
Django is the way to go. You can try it locally on your PC and see do you like it. It is very nice framework and allows you to quickly build your applications.
If you want to give Django quick go to see how it feels you can download Portable Python where everything is preinstalled and ready to use.
You can also do what you are trying to do with apache module mod_python (which is also used to run Django) but it would require more coding. Your code snippet would work with mod_python (http://www.modpython.org/) right away. I think mod_python comes pre-installed on Dreamhost so you can try it.
For a more complete basic setup (with lots of preprogrammed features) I would point you at Pinax which is a web site on top of Django (which I praise of course, see the dedicated page on dreamhost Wiki at http://wiki.dreamhost.com/Django)
The introduction on the project's web site (pinaxproject.com) :
Pinax is an open-source platform built on the Django Web Framework.
By integrating numerous reusable
Django apps to take care of the things
that many sites have in common, it
lets you focus on what makes your site
different.
There you will have a complete web site to customize and add features to.
I've noticed that a lot of people recommend Django. If you're running on a shared host on Dreamhost, the performance will not be satisfactory.
This is a known issue with Dreamhost shared hosting. I have installed web2py on my Dreamhost shared account and it seems to work okay; search the google groups for an install FAQ.
Later edit: google Dreamhost Django performance for an idea of what I mean.
Another voice to the choir.
Go for django. It's very good and easy to use.
I have been doing some work in python, but that was all for stand alone applications. I'm curious to know whether any offshoot of python supports web development?
Would some one also suggest a good tutorial or a website from where I can pick up some of the basics of web development using python?
Now that everyone has said Django, I can add my two cents: I would argue that you might learn more by looking at the different components first, before using Django. For web development with Python, you often want 3 components:
Something that takes care
of the HTTP stuff (e.g.
CherryPy)
A templating language
to create your web pages.
Mako
is very pythonic and works with Cherrpy.
If you get your data from a
database, an ORM comes in handy.
SQLAlchemy
would be an example.
All the links above have good tutorials. For many real-world use-cases, Django will be a better solution than such a stack as it seamlessly integrates this functionality (and more). And if you need a CMS, Django is your best bet short of Zope. Nevertheless, to get a good grasp of what's going on, a stack of loosely coupled programs might be better. Django hides a lot of the details.
Edited 3 years later: Don't use mod_python, use mod_wsgi. Flask and Werkzeug are good frameworks too. Needing to know what's going on is useful, but it isn't a requirement. That would be stupid.
Don't lookup Django until you have a good grasp of what Django is doing on your behalf. for you. Write some basic apps using mod_python and it's request object. I just started learning Python for web-development using mod_python and it has been great.
mod_python also uses a dispatcher in site-packages/mod_python/publisher.py. Have a ganders through this to see how requests can be handled in a simple-ish way.
You may need to add a bit of config to your Apache config file to get mod_python up and running but the mod_python site explains it well.
<Directory /path/to/python/files>
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
And you are away!
use (as a stupidly basic example):
def foo(req):
req.write("Hello World")
in /path/to/python/files/bar.py assuming /path/to is your site root.
And then you can do
http://www.mysite.com/python/files/bar/foo
to see "Hello World". Also, something that tripped me up is the dispatcher uses a lame method to work out the content-type, so to force HTML use:
req.content_type = 'text/html'
Good Luck
After you have a good idea of how Python interacts with mod_python and Apache, then use a framework that does all the boring stuff for you. Up to you though, just my recommendation
If you really don't want to delve into the frameworks - and you should, I heartily recommend Django or Pylons - there's still need to go down the road of CGI. This is a totally out-of-date technology, not to mention slow and inefficient.
There is a standard way of building Python web applications, and it's called WSGI. If you want to roll your own web app from scratch, this is absolutely the way to go.
That said, if you're just starting out, really you should go with one of the frameworks.
Python Wiki: Web Frameworks for Python
If you decide to use Django, the official tutorial is an excellent place to start. The Django Book is also free.
There are a couple of choices for web development. From my experience, your choice will again be dependent on your application. I used django and web.py in production and I am about to deploy an app based on pylons.
Django hides a lot of choices (comes with its ORM and templating). The documentation is extensive and well-written. There are many reusable app available for django, but you will likely to invest a little time in integrating them seamlessly. One thing mentioned on djangocon 08 was the fact, that there is cool stuff in django, which can't be easily
accessed in non-django projects.
web.py impressed me by its raw simplicity. Before I knew it, I wrote a small app (78 lines quasi-wiki) in it.
pylons feels like in the middle of both. I can use sqlalchemy and jinja, all in all a pleasant experience for the start.
Lookup Django.
Python can be used for web development, but there isn't a special language extension or anything in the language that will handle all the HTML generation or that works like PHP.
It's pretty much run through some sort of interpreter on a web server (CGI, mod_python, etc.).
I would recommend looking into Python Web Application Frameworks or how to write Python CGI scripts.
There are quite a few web frameworks for python out there, but the only one I've used is Django, and I really like it.
If you've got a few hours, do the tutorial, I promise you, you'll enjoy it :)
As others have mentioned, one of the more prominent python "offshoots" as you call them would be Django. It is a rather powerful framework that allows you to quickly and securely build web applications. The first place to look would be their overview which gives some insight as to what Django does as a framework.
Going through their tutorial taught me alot about the prominent Model-View-Controler design pattern and how it may be used in a web-development context. I found it a great way to start writing an application that worked and learn by improving it.
Other than basic python syntax, what other key areas should I learn to get a website live?
Is there a web.config in the python world?
Which libraries handle things like authentication? or is that all done manually via session cookies and database tables?
Are there any web specific libraries?
Edit: sorry!
I am well versed in asp.net, I want to branch out and learn Python, hence this question (sorry, terrible start to this question I know).
Basic Python syntax isn't half of what you need to know.
All of the Python built-in data structures.
Object-oriented design.
What python module and packages are.
The Python libraries -- almost everything you could ever want has already been written.
To name a few things.
If you've done some web development, you probably have some background in HTTP protocol, HTML, .CSS and Javascript and SQL.
You should use a framework to handle the endless collection of mundane details, like authentication. Look at Django.
Answer replaced to correspond with the updated question.
If you're already familiar with ASP.NET, the easiest way to jump into creating a website with Python is probably to look into one of the major web frameworks. Django is very popular, working through the installation guide and the tutorial will probably get you rolling pretty well.
Really though, I'd personally suggest at least learning the language itself to a basic competency level before trying to dive right into using it inside a web framework. I think you'll be trying to force yourself to learn too much at once. In terms of just learning Python, the free book Dive Into Python is always spoken of highly.
Oh, golly.
Look, this is gonna be real hard to answer because, read as you wrote it, you're missing a lot of steps. Like, you need a web server, a design, some HTML, and so on.
Are you building from the ground up? Asking about Python makes me suspect you may be using something like Zope.
Don't forget to give IronPython a try - your .NET experience can help making sense of newly learned Python idioms.
IronPython is an implementation of the Python programming language running under .NET and Silverlight. It supports an interactive console with fully dynamic compilation. It's well integrated with the rest of the .NET Framework and makes all .NET libraries easily available to Python programmers, while maintaining compatibility with the Python language.
Of course the builtins. And become familiar with the standard library (until you start to remember what's in it, I'd suggest looking through it any time you're about to implement something... It might be there already!)
You'll want some kind of framework, I'd recommend Django or TurboGears
But you also need to learn the pythonic-way. For this, open up a Python interpreter and type:
import this
I'm wondering if there's such a thing as Django-like ease of web app development combined with good deployment, debugging and other tools?
Django is a very productive framework for building content-heavy sites; the best I've tried and a breath of fresh air compared to some of the Java monstrosities out there. However it's written in Python which means there's little real support in the way of deployment/packaging, debugging, profilers and other tools that make building and maintaining applications much easier.
Ruby has similar issues and although I do like Ruby much better than I like Python, I get the impression that Rails is roughly in the same boat at Django when it comes to managing/supporting the app.
Has anyone here tried both Django and Grails (or other web frameworks) for non-trivial projects? How did they compare?
You asked for someone who used both Grails and Django. I've done work on both for big projects. Here's my Thoughts:
IDE's:
Django works really well in Eclipse, Grails works really well in IntelliJ Idea.
Debugging:
Practically the same (assuming you use IntelliJ for Grails, and Eclipse for Python). Step debugging, inspecting variables, etc... never need a print statement for either. Sometimes django error messages can be useless but Grails error messages are usually pretty lengthy and hard to parse through.
Time to run a unit test:
django: 2 seconds.
Grails: 20 seconds (the tests themselves both run in a fraction of a second, it's the part about loading the framework to run them that takes the rest... as you can see, Grails is frustratingly slow to load).
Deployment:
Django: copy & paste one file into an apache config, and to redeploy, just change the code and reload apache.
Grails: create a .war file, deploy it on tomcat, rinse and repeat to redeploy.
Programming languages:
Groovy is TOTALLY awesome. I love it, more so than Python. But I certainly have no complaints.
Plugins:
Grails: lots of broken plugins (and can use every java lib ever).
Django: a few stable plugins, but enough to do most of what you need.
Database:
Django: schema migrations using South, and generally intuitive relations.
Grails: no schema migrations, and by default it deletes the database on startup... WTF
Usage:
Django: startups (especially in the Gov 2.0 space), independent web dev shops.
Grails: enterprise
Hope that helps!
However it's written in Python which
means there's little real support in
the way of deployment/packaging,
debugging, profilers and other tools
that make building and maintaining
applications much easier.
Python has:
a great interactive debugger, which makes very good use of Python REPL.
easy_install anv virtualenv for dependency management, packaging and deployment.
profiling features comparable to other languages
So IMHO you shouldn't worry about this things, use Python and Django and live happily :-)
Lucky for you, newest version of Django runs on Jython, so you don't need to leave your whole Java ecosystem behind.
Speaking of frameworks, I evaluated this year:
Pylons (Python)
webpy (Python)
Symfony (PHP)
CakePHP (PHP)
None of this frameworks comes close to the power of Django or Ruby on Rails. Based on my collegue opinion I could recommend you kohana framework. The downside is, it's written in PHP and, as far as I know, PHP doesn't have superb tools for debugging, profiling and packaging of apps.
Edit: Here is a very good article about packaging and deployment of Python apps (specifically Django apps). It's a hot topic in Django community now.
The statement that grails deletes the database on start-up is completely wrong. It's behavior on start-up is completely configurable and easy to configure. I generally use create-drop when running an app in dev mode. I use update when I run in test and production.
I also love the bootstrap processing that lets me pre-configure test users, data, etc by environment in Grails.
I'd love to see someone who has really built and deployed some commercial projects comment on the pros / cons. Be a really interesting read.
Grails.
Grails just looks like Rails (Ruby),but it uses groovy which is simpler than java. It uses java technology and you can use any java lib without any trouble.
I also choose Grails over simplicity and there are lots of java lib (such as jasper report, jawr etc) and I am glad that now they join with SpringSource which makes their base solid.
I have two friends who originally started writing an application using Ruby on Rails, but ran into a number of issues and limitations. After about 8 weeks of working on it, they decided to investigate other alternatives.
They settled on the Catalyst Framework, and Perl. That was about 4 months ago now, and they've repeatedly talked about how much better the application is going, and how much more flexibility they have.
With Perl, you have all of CPAN available to you, along with the large quantity of tools included. I'd suggest taking a look at it, at least.
The "good deployment" issue -- for Python -- doesn't have the Deep Significance that it has for Java.
Python deployment for Django is basically "move the files". You can run straight out of the subversion trunk directory if you want to.
You can, without breaking much of a sweat, using the Python distutils and build yourself a distribution kit that puts your Django apps into Python's site-packages. I'm not a big fan of it, but it's really easy to do.
Since my stuff runs in Linux, I have simple "install.py" scripts that move stuff out of the Subversion directories into /opt/this and /opt/that directories. I use an explicit path settings in my Apache configuration to name those directories where the applications live.
Patching can be done by editing the files in place. (A bad policy.) I prefer to edit in the SVN location and rerun my little install to be sure I actually have all the files under control.
cakephp.org
Cakephp is really good, really close to ruby on rails (1.2). It is in php, works very well on shared hosts and is easy to implement.
The only downside is that the documentation is somewhat lacking, but you quickly get it and quickly start doing cool stuff.
I totally recommend cakephp.
Personally I made some rather big projects with Django, but I can compare only with said "montrosities" (Spring, EJB) and really low-level stuff like Twisted.
Web frameworks using interpreted languages are mostly in its infancy and all of them (actively maintained, that is) are getting better with every day.
By "good deployment" are you comparing it with Java's EAR files, which allow you to deploy web applications by uploading a single file to a J2EE server? (And, to a lesser extent, WAR files; EAR files can have WAR files for dependent projects)
I don't think Django or Rails have gotten quite to that point yet, but I could be wrong... zuber pointed out an article with more details on the Python side.
Capistrano may help out on the Ruby side.
Unfortunately, I haven't really worked with either Python or Ruby that much, so I can't help out on profilers or debuggers.