tags:

views:

190

answers:

5

Here's my background: Decent experience with PHP/MySql. Beginner's experience with OOP

  1. Why I want to learn Python Django? I gave in, based on many searches on SO and reading over some of the answers, Python is a great, clean, and structured language to learn. And with the framework Django, it's easier to write codes that are shorter than with PHP

  2. Questions

    1. Can i do everything in Django as in PHP?

    2. Is Django a "big" hit in web development as PHP? I know Python is a great general-purpose language but I'm focused on web development and would like to know how Django ranks in terms of web development.

    3. With PHP, PHP and Mysql are VERY closely related, is there a close relation between Django and Mysql?

    4. In PHP, you can easily switch between HTML, CSS, PHP all in one script. Does Python offer this type of ease between other languages? Or how do I incorporate HTML, CSS, javascript along with Python?

+1  A: 
  1. Yes.
  2. It's very hard to tell exactly how popular it is.
  3. MySQL is officially supported.
  4. Yes, but probably not in the way you think. Please read this and also follow the tutorial that S.Lott mentions.
Christian Jonassen
A: 

I created one project in Python-Django.Very Very Good Framework.The development can be too much fast in Django.

Yes you can do everything and for most common things it has inbuilt modules.

I think yes it is a big Hit. Not much a hit like PHP may be because python is bit hard to learn for beginners.

Arsheep
I thought Python was an easy language, at least compared to Java and such.
ggfan
+3  A: 

Can i do everything in Django as in PHP?

Always

Is Django a "big" hit in web development as PHP?

Only time will tell.

With PHP, PHP and Mysql are VERY closely related, is there a close relation between Django and Mysql?

Django supports several RDBMS interfaces. MySQL is popular, so is SQLite and Postgres.

In PHP, you can easily switch between HTML, CSS, PHP all in one script.

That doesn't really apply at all to Django.

Or how do I incorporate HTML, CSS, javascript along with Python?

Actually do the Django tutorial. You'll see how the presentation (via HTML created by templates) and the processing (via Python view functions) fit together. It's not like PHP.

S.Lott
Thank you!! Yes, I am just about to start the Django tutorial, just figure I ask some 'basic' questions before; not trying to be lazy or anything. It seems Django follows MVC which is much better than PHP(unless using a framework)
ggfan
Yeah, it's way easier/better to maintain and extend.
Thiago Silveira
Can you elaborate on why it's easier to maintain?
ggfan
@ggfan: 1st, do the tutorial. 2nd, build several web sites. 3rd, reflect on how separation of concerns is a good thing. There's no easy answer to why separation is easier to maintain. After you've done it, however, you will prefer it.
S.Lott
@ggfan: "why it's easier to maintain?" That's a separate question. Similar to all of these: http://stackoverflow.com/search?q=separation+of+concerns. Perhaps this answers your question: http://stackoverflow.com/questions/1376643/mvc-separation-of-concerns
S.Lott
+1  A: 
  1. No. You can only do a LOT better.
  2. Awesome, popular. Supported by best hosters like Mediatemple.
  3. No. You can just change 'mysql' to 'postgresql' or 'sqlite' in your settings.py.
  4. NO! Python would never give you the right to mix up everything in one file and make the shittest shit in the world. Templates, static server.

Django is a Model-Template-View framework, great for any applications, from small to huge. PHP works fine only with small apps. Yeah, PHP == Personal Home Page, lol.

P.S. Also you can minify your CSS and JS. And compile to one single file (one js, one css). All with django-assets. And yeah, there's a lot more reusable Django apps (for registration, twi/facebook/openid auth, oembed, other stuff). Just search Bitbucket and Github for "django". No need to reinvent a bicycle, like you do with PHP.

myfreeweb
+1 for the profanity. Bad code is always worth swearing about.
twneale
+1  A: 

In PHP, you can easily switch between HTML, CSS, PHP all in one script. Does Python offer this type of ease between other languages? Or how do I incorporate HTML, CSS, javascript along with Python?

That's one of the reasons why PHP is so easy to learn. And it's also exactly why so many (if not most) PHP projects are such a complete mess. It's what leads to the "spaghetti code" syndrome.

Django is all about complete separation of page design from view logic from URL routing (in fact this is true of most modern MVC or MTV frameworks). So templates are in one place, data structure definitions are in another, and the logic that defines their interaction is in another. It takes a bit of getting used to, but has a huge payoff.

Another thing that takes getting used to for people coming from PHP is that fact that file and foldernames no longer have a direct bearing on the URL. For example in PHP, you might have foldername/filename.php and the URL would be http://example.com/foldername/filename.php. It doesn't work like that in Django. Instead, you define a URL structure in a file (urls.py). In that "map" you define which piece of logic ("view code") will be called when a matching URL is intercepted. Everything is abstracted like that. The result is a much cleaner, more logical site layout and logic.

shacker