Monday, March 25, 2013

Re: What are the steps to build a website?

Tom,

I build some websites with PHP a long time ago. So I have the concepts, but I miss the tools. Django seems awesome so I decided to give it a try while I start my own project.

I am doing point 1) & 2), along the way I came here to check if I'm not heading to a wall.

3) awesome, I'll start with a simple one yes, this one for instance: https://github.com/upTee/upTee/tree/master/uptee.

I didn't know about the the template inheritance, I'm glad I asked.

Thank you !

On Monday, March 25, 2013 2:07:56 PM UTC+1, Tomáš Ehrlich wrote:
> You can't do it perfectly the first time. The only way to do it well
> is experience. The only way to get experience is to make mistakes.

I disagree. When you make mistake, you know what's wrong, but you still
don't know, what's right. You need to learn, how to make things right.


To Benjamin:
Question is: Do you have any experiences with building websites? Other
languages, frameworks? If your answer is "yes" and you've just start
learning Django/Python as a new way to build websites, try following:

 1) Take your time to finish tutorial and at least skim through
documentation. It can be overwhelming for the first time, but even
after couple of years developing in Django I always find something in
documentation which makes my life easier (I'm probably lousy reader.)
    Most of your questions could be answered by simply pointing you to
the right page in documentation. Also there  are other good books to read:
 eg http://www.djangobook.com/en/2.0/index.html

 2) Write something. Any thing. What about your own blog app? :)

 3) Look at http://www.djangosites.org/ Some of those sites have public
sources. However, some of them may be confusing. Try to find some
simple ones.

If your answer is "no", then don't expect that you won't make design
mistakes and simply dive into.


To your questions:
 1) Yes, that's usual approach. However, Django has it's own user
management, so you can use it or extend it. Templates for login page
are usualy in some "global" directory (I use <project>/templates).
Location of other basic pages depends on what they are. Are the static?
Then you can leave them in global dir. Are they dynamic? Then you need
an view, to render them, which belongs to one of your apps.

 2) Both are probably good idea. I usualy draw on paper few pages to
get the idea about whole website settled. But today with
twitter-bootstrap and similar frameworks, you can as easily create
sketches of your pages directly as html and use it later as skeleton
for your templates.
  Populate test DB isn't good idea, rather try to create fixtures and
load them, because then you can use them in your tests.
https://docs.djangoproject.com/en/1.5/howto/initial-data/

 3) It depends. How generic is your code? Do you want to reuse it in
other projects? Then create app. Is this code specific for this project
only and you are 100% sure you won't need it anymore in future? Then
you can store it in project app.
  You example, however, is a bad idea. Django has template engine which
allows you to extend templates. You don't need to glue together header,
body and footer templates. You just create base template with header,
body, footer blocks (for example) and define it's content later.
https://docs.djangoproject.com/en/1.5/topics/templates/#template-inheritance


Cheers, Tom
 

--
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment