Code organisation

68 views
Skip to first unread message

Benjamin Melki

unread,
Jan 22, 2016, 9:31:07 AM1/22/16
to django...@googlegroups.com
Hello,

i’m building my first site with this great framework and language that are Django and Python.
I try as much as possible to favor code reuse.

On one of my model, I do some work with the instance before saving it.
Works is mostly image related: resizing image, compressing, saving thumbs, and a couple more stuff.

I will need this behavior in almost all the projects that I will building, and even some other apps in the same project will need this feature: the blog, the comments, the directory…..

In this case, where to put this code ? What do guys and gals do usually in this situation ? 
Do you just put it in a custom (non app) folder like ‘my_utilities’ ?

Advices welcome.

Thanks,
Benj

Rafael E. Ferrero

unread,
Jan 22, 2016, 10:20:55 AM1/22/16
to django...@googlegroups.com
Maybe you find useful make your project into a reusable app look at this https://docs.djangoproject.com/en/1.9/intro/reusable-apps/

Cheers !!


Rafael E. Ferrero

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4319BF33-90C3-47E5-B068-B2DAADFC4FE0%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Benj

unread,
Jan 22, 2016, 4:06:44 PM1/22/16
to Django users
Yes, I didn't thought about creating a whole app for utilities, but it is indeed the way to go. Tks

Derek

unread,
Jan 23, 2016, 8:49:56 AM1/23/16
to Django users
Utilities app is the way to go - and attach ALL business logic to your models; this will save you headaches in the long run...

Daniel Chimeno

unread,
Jan 24, 2016, 6:35:16 AM1/24/16
to Django users
Hello,
It seems that if you need (blog, comments, image manipulation), are you developing a custom CMS?
Maybe you find something useful here.

Benjamin Melki

unread,
Jan 24, 2016, 7:09:52 AM1/24/16
to django...@googlegroups.com
Hello,
thanks for the link.

Indeed, I hesitated a long time before deciding not to use a cms. I think I would probably have used a PHP cms if I had chosen this route.

But I chose to stick with raw Django. Yes it is more work, but i’m building my first kinda cms to be reusable, with my own style and practice for my own needs, so on subsequent projects things should go really fast.

This time, and this may evolve at a later point, I prefer to stick with pure django: no need to learn CMS ways of doing things, less dependency on a new layer of code….. for my first delve in the Django world (and most generally the python world) I’m just starved to code with this extraordinary combo of python / django.

But wether to use a CMS or not for general content management is a true question.

Benj

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/L0auf9v0ds0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Philip Southwell

unread,
Jan 24, 2016, 8:51:16 AM1/24/16
to Django users
Could I recommend Mezzanine CMS as a starting point? It contains everything you need to get a django CMS off the ground with easy adaptability for custom apps you write yourself. Check it out at http://mezzanine.jupo.org

Benjamin Melki

unread,
Jan 24, 2016, 9:06:35 AM1/24/16
to django...@googlegroups.com
This CMS really looks awesome. But I don’t think I would do it justice, if I don’t learn first the framework: Django.
I think I will really appreciate getting into CMS after learning the framework and publishing a few projects with it.
Then you can truly appreciate what the CMS can give you.


Le 24 janv. 2016 à 14:51, Philip Southwell <ph...@zoothink.com> a écrit :

Could I recommend Mezzanine CMS as a starting point? It contains everything you need to get a django CMS off the ground with easy adaptability for custom apps you write yourself. Check it out at http://mezzanine.jupo.org

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/L0auf9v0ds0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages