Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Other - Discussion
Author Message
Gremmie
Former Moderator in Good Standing



Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Mon Mar 31, 2008 12:20 pm Reply with quote

Holy crap!

You model your database tables by creating a python class for each table. From each class Django automatically creates the correct SQL for your backend database (e.g. CREATE TABLE). It also generates a Python API to your table. In other words, you never need to write SQL ever again. Update the database by manipulating a python object. Sweet!

You also get, for free, an admin interface to your apps! No need to write an interface to let admins add and update content. Again, it just looks at your model to figure out how to do this.

It uses a template system to separate display from application code.

I'm 1/2 way into the 2nd tutorial and I'm sold. From what I've seen so far, it is not as beginner friendly or general purpose as PHP-Nuke (you need to be a python programmer to setup your site), but wow does it look powerful and cool if you are a web developer.

I was trying to convert a friends static HTML site into OO PHP 5. I might give it a go with Django instead.

http://www.djangoproject.com/

(BTW I'm new to python, but I like what I see so far. I wrote an IRC "bot" in python that sits in our server's IRC channel and watches who comes and goes. It updates a MySQL database so my RavenNuke site can display who is in the channel in a block. I leveraged a python IRC and MySQL library. Once I figured out how to use those 2 libraries, it was a snap to make the bot. Fun stuff!)

_________________
Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module 
View user's profile Send private message
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Mon Mar 31, 2008 12:52 pm Reply with quote

worship
 
View user's profile Send private message
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Mon Mar 31, 2008 3:12 pm Reply with quote

Better than Code Igniter or Ruby on Rails?

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Gremmie







PostPosted: Mon Mar 31, 2008 3:39 pm Reply with quote

Don't know as I haven't looked at too many frameworks in detail. I have studied Zend and Code Igniter a little bit. Like those you mention, Django is just a framework, one could use it to build a CMS like Nuke, Drupal, Joomla, etc.

It is being used on real world sites and claims to be able to handle load. Ruby on Rails has been criticized for being too slow, but I don't know enough to say either way. Python probably has more miles on it than Ruby and has been optimized more. But again I dunno. It sure looks neat.

Here is a whole book on it, available for free online:

http://www.djangobook.com/
 
djmaze
Subject Matter Expert



Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv

PostPosted: Wed Apr 02, 2008 4:23 pm Reply with quote

CRUD designs suck, you ever needed a UNION or JOIN's ?
 
View user's profile Send private message Visit poster's website
Gremmie







PostPosted: Wed Apr 02, 2008 5:01 pm Reply with quote

Django creates intermediate join tables for you when you indicate a table has foreign keys. They do not preclude you from writing your own SQL by hand, they just make it easy for you to avoid it in the common cases.

Another cool thing that they can derive from your python classes that represent your database table is automatic form generation and validation.

I'm approaching this with a cautious eye, but so far I like what I see. I'm working through the tutorial and hope to cut over a small static html site to it when I get some time.
 
djmaze







PostPosted: Thu Apr 03, 2008 11:04 am Reply with quote

Now we're talking.
I disliked starting to learn "ruby on rails" because of the massive CRUD floating around.

I'm a die-hard that uses union, (inner|outer|left|right) join, views, triggers, procedures and who knows what else a RDBM provides me.
MyISAM (not a rdbm!) just sucks because i can't use them, but on the other hand i can build fast websites with it that accommodate some people their needs.
But then you don't want a massive framework that eats CPU and classes just to show a page either.

Problem with all the RDBM features is that it is hard to write automatic CRUD style frameworks for the ease of things.
But maybe i just create to advanced websites to ever need the ease of use you people want.
 
Gremmie







PostPosted: Thu Apr 03, 2008 11:20 am Reply with quote

I hear ya, I usually like to be in total control myself and despise bloat ware. But this thing really, really saves you from writing lots of tedious code. It is quite amazing. The fact that they can build a complete admin interface for you to allow editors to enter/update content, and do this only from your Python classes that represent your tables is quite stunning. Now I totally see the power of introspection. PHP 5 has similar capabilities in this area also.

I believe in using the right tool for the right job and I can certainly see using something like this to bang out a blog or website for a friend in a weekend. But the developers use this framework to power several newspaper sites so it can apparently scale up.

Anyway I'm going to try to convert a friends website to it hopefully this weekend. Setting up Apache with mod_python may be a bit tricky (for me) but we'll see.
 
gotcha
Regular
Regular



Joined: Mar 14, 2005
Posts: 91

PostPosted: Thu Apr 03, 2008 12:24 pm Reply with quote

Sounds alot like cakePHP - http://cakephp.org/
I've been messing with it a bit and I can say that the joins can be quite taxing, but once you go through and optimize everything it is not so bad. Turn on the built in caching and your in business. But for smaller apps, the overhead probably isn't worth it. It is kinda fun to work with as you just create the table structure, type in a couple of commands in the terminal, answer a few questions, and all the sudden you have all the basic code in place to list/add/edit/delete/view.
 
View user's profile Send private message Visit poster's website
Gremmie







PostPosted: Sun Apr 06, 2008 5:32 pm Reply with quote

I spent many many hours this weekend with Django. I didn't finish converting my friend's website for him like I imagined, mainly because of the learning curve for both Django and Python. However, I have built several apps for his site, and it is quite amazing. Once you define your database tables in python, you pull a lever and it creates the tables for you as well as an admin interface to immediately begin adding data. Sprinkle some metadata in your python classes and you can very quickly build a powerful admin interface that includes support for searching, editing, filtering, and even seamlessly handles editing objects as part of other objects when you have one to many or many to many database relationships. In fact, I spent most of my time learning how to do this part and just playing with it.

Django, like lots of other frameworks, strongly supports a separation of coding from view; the so called MVC paradigm. Django calls it the MTV (model-template-view). I really really like this. When I am coding the "view" all I do is concentrate on obtaining the data for display. And using their database API is a breeze. Instead of writing SQL you just chaing together calls on a python object manager for your table:

news = News.objects.order_by('-date')[:10]

obtains the last 10 news posts in reverse date order (date in this case is a column in the table).

You then pass your news variable to a template .html file which has a very small mini language for looping over the news objects and displaying them. When you build the template all you have to think about is how to display it. In PHP-Nuke of course, 99% of the time your display and business logic is totally mixed up together.

Their template system is optional, you could use another one, or even choose not to use it at all (like what we do in Nuke), but it is pretty powerful. It features template inheritance, so you can flesh out what the whole page is going to look like in one template, leaving "holes" for more specific pages to fill in. The holes can have defaults too in case no one fills them in.

It comes with a development server so you don't have to even setup a web server to try it out. However it was very easy to add mod_python to my XAMPP install and use it that way.

I wish I could stay home this week from work and finish this. It is really cool. I'm really impressed.
 
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6437

PostPosted: Sun Apr 06, 2008 6:41 pm Reply with quote

Last week, I saw some interesting discussions about various frameworks, including CakePHP, CodeIgniter, Symfony and Zend:

http://www.phpit.net/article/ten-different-php-frameworks/
http://snook.ca/archives/php/zend_framework_first_impressions/
http://www.dustinweber.com/web-development/cakephp/the-best-php-framework-is-symfony-really-it/
http://2tbsp.com/node/87

Several comments suggest that, at this point, Zend Framework, is more a library of code, than a framework. Of course, since I already use SimplePie, I'm predisposed to use Cake... Smile

_________________
I search, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
Gremmie







PostPosted: Sun Apr 06, 2008 7:21 pm Reply with quote

Cool, more interesting things to read about!
 
Gremmie







PostPosted: Thu Apr 24, 2008 8:17 pm Reply with quote

Here is a nice writeup that summarizes django:

http://www.digital-web.com/articles/intro_to_django_helping_perfectionists_with_deadlines/

I've been working with it for 3 or 4 weeks now and I think it is awesome. I found a photo gallery plug-in for it and after I figured out how to use it I was making galleries in minutes and even integrated it with the thickbox javascript.
 
Gremmie







PostPosted: Tue May 27, 2008 7:01 am Reply with quote

I got the site up and running, which was a tad more difficult than a typical PHP site. I'm very happy with it.

Another very cool thing is that it seamlessly integrates with Only registered users can see links on this board! Get registered or login!. Once I got memcached built on my server and python bindings for it, the site SCREAMED. I just had to add a couple of lines in my config file, no code changes on my part. I wish Nuke had something like this.
 
kguske







PostPosted: Tue May 27, 2008 10:41 am Reply with quote

There have been several approaches to integrating various cache functions with Nuke. There is sure to be plenty of discussion in the forums here on that subject...
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Tue May 27, 2008 5:42 pm Reply with quote

Yeah, the Zend Framework even has some caching, but, admitidly, I have not looked at very carefully (just saw that they have something - lol). I've had to convert over a Blogger site to b2evolution and found the ZF invaluable. Made my job 100 times easier.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Gremmie







PostPosted: Thu Sep 04, 2008 11:10 am Reply with quote

Well Django just released version 1.0 after 3 years of development!

http://www.djangoproject.com/weblog/2008/sep/03/1/

I urge you guys to check this out. Download the code and try out the tutorial. It even comes with a mini development server so you don't need to futz with XAMPP or Apache to try it out.

For support there is a wiki, an active google group, a very helpful IRC channel, and a (mostly) weekly podcast. It is really an amazing system.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Other - Discussion

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©