Saturday, August 26, 2017

Re: Build Django Blog

Hello Zayden,

I don't often comment here, but I've build a number of blog type apps, and I'm currently looking at building a blog for a Python society in my area, so it's something I've been thinking about.

Clearly, there are other options other than Django if your goal is to set up a blog easily, as Gerardo mentioned.  So, I assume you do want to dig into Django itself.  I'm not sure why you say the Quora page isn't helpful - one of the answers there refers to the Djangogirls tutorial, which I've heard is one of the easiest, and would certainly help get you started.

So, here is my recommendation:
1.  You need to understand basic Django.  The tutorial in the documentation is really, really fantastic.  While you don't build a blog in the tutorial, many of the concepts you need to master to do so (urls, views, models and forms) are all in there.
2.  Build up a basic, minimum feature blog app, without all the bells and whistles - you probably want A) a list page that is the home page of your blog where you show the first few blog posts (let's say, 5 posts).  B) a detailed page - a page for each blog post C) archive pages for older posts, D) depending on your URL structure, a list page by year or month, or even day if you have a popular, active blog.  I have an old version of my blog on github you can look at (it might not be the best, it's old and I've learned a lot since then, but looking through it should give you a good starting point).  To start with, just use the django admin for posting blog posts - later on you can roll your own or clone one of many others and adapt to your needs.  One of the topics you really need to master at this point is model queries.  I recommend building models and then just playing around in the django shell (python manage.py shell) with the model objects.  Here are the docs for the models.
3.  If you want to role your own comment system, then next thing you'll need to master are the forms (including ModelForms).
4. To start having different authors, you'll need to dig into the User authentication system.
5. If you want to have your own 'admin' to post from, you'll need some good front end skills to implement text editing things (i.e. making text bold) using Javascript.  

Basically, with a good understanding of the basics (urls, views, models, templates, forms, authentication) it's only up to your creativity from there how to implement the rest.  Django's approach is very modular, and so I recommend a modular approach to building this up - go step by step, adding complexity only after you have the first bit working well.  If you take this approach, and learn the bits well, building things with Django becomes remarkably simple.

I would highly recommend looking into class based views.  They have a reputation for being a bit hard to grasp, but I don't think they're hard at all if you have the basic concepts down.  And it allows you to use inheritance to avoid huge, over complex views.

If you're a developer, I would imagine you do this already, but when I build things, I spend a lot of time poking around people's github repos and just getting ideas, and then implementing my version of it.  For some things you may want to set up a dummy project, clone the repo, and run it and play with it so you see how they made it work, even if you're going to implement your own.

And, finally, look into testing - if you're building something that's going to be growing in complexity, taking a TTD approach is going to save you a lot of headaches in the long run.  A fun book to work through is "Test-driven development with Django", aka, 'Obey The Testing Goat'.

Cheers,
Vernon

On Saturday, 26 August 2017 22:27:52 UTC+1, Zayden Rosario wrote:
Currently, I am a beginner who hardly knows how to create a post, I want to know what are the requirements to create a fully featured blog (Ex: supports edits from multiple users, post can have multiple tags, create my own administration page ..etc)

please keep in mind that I know these resources and they aren't that helpful


It will be really helpful if the resources are from the Django official documentation.

Thanks,

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/f1780da3-8230-4e42-99bb-13b02ca8f64f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment