Questions before switching from drupal to django

24 views
Skip to first unread message

Josh

unread,
Jul 9, 2011, 4:19:03 AM7/9/11
to Django users
I want to switch my sites from Drupal to Django. I already read a lot
about Django and made a few sample apps. I think Django is better
suited to my needs, but I do have a few questions that I couldn't find
an answer for. So I thought of a few solutions that might do the
trick. I'm not really a web designer or a programmer, so the
terminology I use might be wrong.Some hints, references to sample-apps
(so I can look at the code) or other resources on the internet are
welcome.

1. URL generation
The sites will have a substantial number of pages that will be
generated. The content is stored in a database. I was thinking of
creating a seperate table for page-names. E.g.
pagename - database_id ( page-about-something.htm, id12345 ; category/
page-about-something.htm, id12345).
I'll store these in a dictionary (name:, database_id) and use this to
avoid duplicate names and keep track of already present names. This
way I can also alias pages.
Basically this is a question about how to handle a large number of
different pages?

2. Layout of webpages - main content area
I think I understand the templating system of Django. In Drupal there
are a lot of ways to generate layouts and depending on the content
( areas such as head, above-content, content, left-column, right-
column etc can be defined and depending on the context blocks of
content can be displayed). The header/footer part isn't that
difficult, but I'm having problems how to do the main content area.I'm
not sure how to do this in Django (or start with it).

For example:
main content area
- frontpage 3 columns with different components (widgets/blocks) in
each column
- normal page 2 columns (but may contain different outcomes depending
on content)
-- main content area
-- column with different components (widgets, blocks)


Venkatraman S

unread,
Jul 9, 2011, 8:59:33 AM7/9/11
to django...@googlegroups.com
Trust me but take this advice : try to develop a simple webapp in django which stores an Item in a table
and when requested displays to the user. And if you want , you can also look at sample apps in here ,
and build along with the instructions: http://www.lightbird.net/dbe/

http://www.djangobook.com/ is also there for reference. and djangoproject.com has some tutorials.

Once you do them, it will breeze for you to convert your site; and also it will help you in the longer run
to maintain and enhance it.

Enjoy.

-V

Cal Leeming [Simplicity Media Ltd]

unread,
Jul 9, 2011, 9:15:22 AM7/9/11
to django...@googlegroups.com
Unless of course, you are looking to become a programmer? If so, then welcome aboard :)

On Sat, Jul 9, 2011 at 2:15 PM, Cal Leeming [Simplicity Media Ltd] <cal.l...@simplicitymedialtd.co.uk> wrote:


On Sat, Jul 9, 2011 at 9:19 AM, Josh <jos.car...@yahoo.com> wrote:
I want to switch my sites from Drupal to Django. I already read a lot
about Django and made a few sample apps. I think Django is better
suited to my needs, but I do have a few questions that I couldn't find
an answer for. So I thought of a few solutions that might do the
trick. <snip> 
 
I'm not really a web designer or a programmer, <snip>

Then stick with Drupal.

Drupal is a CMS. Django is a framework. There's a *big* difference.
 


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



Cal Leeming [Simplicity Media Ltd]

unread,
Jul 9, 2011, 9:15:03 AM7/9/11
to django...@googlegroups.com
On Sat, Jul 9, 2011 at 9:19 AM, Josh <jos.car...@yahoo.com> wrote:
I want to switch my sites from Drupal to Django. I already read a lot
about Django and made a few sample apps. I think Django is better
suited to my needs, but I do have a few questions that I couldn't find
an answer for. So I thought of a few solutions that might do the
trick. <snip> 
 
I'm not really a web designer or a programmer, <snip>

Then stick with Drupal.

Drupal is a CMS. Django is a framework. There's a *big* difference.
 
so the

Josh

unread,
Jul 9, 2011, 11:24:23 AM7/9/11
to Django users
On 9 jul, 15:15, "Cal Leeming [Simplicity Media Ltd]"
<cal.leem...@simplicitymedialtd.co.uk> wrote:
> On Sat, Jul 9, 2011 at 9:19 AM, Josh <jos.carpente...@yahoo.com> wrote:
> > I want to switch my sites from Drupal to Django. I already read a lot
> > about Django and made a few sample apps. I think Django is better
> > suited to my needs, but I do have a few questions that I couldn't find
> > an answer for. So I thought of a few solutions that might do the
> > trick. <snip>
> > I'm not really a web designer or a programmer, <snip>
>
> Then stick with Drupal.
>
> Drupal is a CMS. Django is a framework. There's a *big* difference.
>
>
I'm not a programmer by profession, but I use Python a lot. For
example, I use it to interface with the 90+ tables of Drupal directly
to avoid php. Drupal is just horrible with all dependencies and
trying to get the proper data displayed. Php just isn't my thing and
you seem to spend ages with troubleshooting, figuring out how to do
things.

In Python I can easily get the data I want, but I don't really
understand the advanced templating and URLconfig in Django yet. I
think I can make the apps I want (or rebuild existing ones), but
putting these together is my problem. On internet and in the books not
a lot of information can be found on integrating say 10 different apps
on a single page.

Cal Leeming [Simplicity Media Ltd]

unread,
Jul 9, 2011, 11:39:17 AM7/9/11
to django...@googlegroups.com
Ah my mistake, I thought you were looking to use Django in a completely non programmer sense.

And if you are already experienced in Python, then yeah go for it :)

Best place to start is in the official docs (or maybe in djangobook).

Cal

VWAllen

unread,
Jul 9, 2011, 3:38:02 PM7/9/11
to django...@googlegroups.com

I'm not a programmer by profession, but I use Python a lot. For
example, I use it to interface with the 90+ tables of Drupal directly
to avoid php. Drupal is just horrible  with all dependencies and
trying to get the proper data displayed. Php just isn't my thing and
you seem to spend ages with troubleshooting, figuring out how to do
things.

In Python I can easily get the data I want, but I don't really
understand the advanced templating and URLconfig in Django yet. I
think I can make the apps I want (or rebuild existing ones), but
putting these together is my problem. On internet and in the books not
a lot of information can be found on integrating say 10 different apps
on a single page.

It doesn't sound like you're using Drupal in a "drupally" way so there will be less of a transition-shock than might be the case. You still might want to look into a Django based CMS, though, because Drupal provides a lot of functionality that Django obviously won't out of the box. Here's a handy list: http://djangopackages.com/grids/g/cms/

To answer your original questions:
1 - Common practice is to use a SlugField for what you're calling a "page id" and making it part of your models. You can make it unique or unique in combination with other fields within Django. If you use a CMS built on top of Django, you'll likely get a Page model already built that will handle a lot of your requirements. If you use a concrete base class  for you Models (not usually recommended), you can enforce uniqueness on the slugs at the database level (at the cost of additional joins). Check out the docs for SlugField and model inheritance.

2 - Unless you build or use a 3rd-party app, there is no auto-assignment of templates in the same way as Drupal's baroque theming system. Again, a pre-built CMS system should have a simple way of mapping pages to layouts, and it isn't too difficult to build a Page model that has a layout as a property or a system that introspects the request and assigns templates based on rules. You can get an analog of Drupal's template override system with a few lines of Python and  django.template.loader.select_template(). I would read up on the template loading mechanism or take advantage of whatever CMS you are using (if you decide to go that route).

V

Reply all
Reply to author
Forward
0 new messages