You've done the Django Tutorial, what next?

67
Y ou’ve done the Django tutorial. What next? Andy McKay Clearwind Consulting @clearwind

description

Some suggestions on where to look next when building that next Django site

Transcript of You've done the Django Tutorial, what next?

Page 1: You've done the Django Tutorial, what next?

You’ve done the Django tutorial.What next?

Andy McKayClearwind Consulting

@clearwind

Page 2: You've done the Django Tutorial, what next?

build something

Page 3: You've done the Django Tutorial, what next?

my opinions, likely wrong

Page 4: You've done the Django Tutorial, what next?

1. Setting up2. Writing models3. Middle years4. Avoid5. Tools

Page 5: You've done the Django Tutorial, what next?

Part I: Setting up

Page 6: You've done the Django Tutorial, what next?

app vs project vs...

Page 7: You've done the Django Tutorial, what next?

past caring

Page 8: You've done the Django Tutorial, what next?

app directory

Page 9: You've done the Django Tutorial, what next?

(a). base templates

Page 11: You've done the Django Tutorial, what next?

def context(request): data = {} return data

Page 12: You've done the Django Tutorial, what next?

(c). render shortcutseg: http://www.djangosnippets.org/snippets/1022/

Page 13: You've done the Django Tutorial, what next?

(d). site constants

Page 15: You've done the Django Tutorial, what next?

(f) your auth. backendhttp://docs.djangoproject.com/en/dev/topics/auth/#topics-auth

Page 16: You've done the Django Tutorial, what next?

(g) base classes

Page 17: You've done the Django Tutorial, what next?

model base class

Page 18: You've done the Django Tutorial, what next?

class Base(models.Model): class Meta: abstract = True

Page 19: You've done the Django Tutorial, what next?

form base class

Page 20: You've done the Django Tutorial, what next?

class Form(forms.Form):! pass

class ModelForm(forms.ModelForm):! pass

Page 21: You've done the Django Tutorial, what next?

Part 2: Writing models

Page 22: You've done the Django Tutorial, what next?

(a) fixtures

Page 23: You've done the Django Tutorial, what next?

not just for testing

Page 24: You've done the Django Tutorial, what next?

create data in admin

Page 25: You've done the Django Tutorial, what next?

manage.py dumpdata

Page 26: You've done the Django Tutorial, what next?

(b) migration

Page 27: You've done the Django Tutorial, what next?

during development

Page 28: You've done the Django Tutorial, what next?

reset scripthttp://www.agmweb.ca/blog/andy/2154/

Page 29: You've done the Django Tutorial, what next?

drop db, create db, syncdb, load fixtures, start up server etc...

Page 30: You've done the Django Tutorial, what next?

my workflow

Page 31: You've done the Django Tutorial, what next?

1. create app within project2. define models3. access admin4. smoke test models5. alter, run “reset”6. access admin (back to 4 until happy)7. enter sample data8. dump data to fixtures9. add fixture loading to “reset”10. continue... write tests and retail view

Page 32: You've done the Django Tutorial, what next?

at some point... beta?

Page 33: You've done the Django Tutorial, what next?

Southhttp://south.aeracode.org/

Page 34: You've done the Django Tutorial, what next?

Part 3: The middle years

Page 35: You've done the Django Tutorial, what next?

(a) signals

Page 37: You've done the Django Tutorial, what next?

signals.pre_save.connect(! add_profile, ! sender=User)

Page 39: You've done the Django Tutorial, what next?

(b) URLs

Page 40: You've done the Django Tutorial, what next?

always use named urlshttp://docs.djangoproject.com/en/dev/topics/http/urls/#url

Page 41: You've done the Django Tutorial, what next?

urlpatterns = patterns('', url(r'^index/$', index_view, name="main-view"), ...)

Page 42: You've done the Django Tutorial, what next?

reverse(“main-view”)

Page 43: You've done the Django Tutorial, what next?

{% url main-view %}

Page 45: You've done the Django Tutorial, what next?

def boring(request): ... return some_html

Page 46: You've done the Django Tutorial, what next?

class boring: def get(request): ... return some_html

Page 47: You've done the Django Tutorial, what next?

Part 4: Avoid these

Page 48: You've done the Django Tutorial, what next?

generic viewshttp://docs.djangoproject.com/en/dev/ref/generic-views/

Page 49: You've done the Django Tutorial, what next?

push logic into urls,always need rewriting

Page 50: You've done the Django Tutorial, what next?

custom template tags(maybe)

Page 51: You've done the Django Tutorial, what next?

complicated templates

Page 52: You've done the Django Tutorial, what next?

{% div %} {% dl %} {% dt %}Name{% enddt %} {% dd %}Definition{% enddd %} {% enddl %}{% enddiv %}

Page 53: You've done the Django Tutorial, what next?

some of django.contrib...

Page 54: You've done the Django Tutorial, what next?

comments

Page 55: You've done the Django Tutorial, what next?

Part 5: Debug Tools

Page 56: You've done the Django Tutorial, what next?

pdbhttp://docs.python.org/library/pdb.html

Page 57: You've done the Django Tutorial, what next?

pdbhttp://docs.python.org/library/pdb.html

(not optional)

Page 58: You've done the Django Tutorial, what next?

ipythonhttp://ipython.scipy.org/moin/

Page 59: You've done the Django Tutorial, what next?

ipdbhttp://pypi.python.org/pypi/ipdb

Page 60: You've done the Django Tutorial, what next?

django debug toolbarhttp://github.com/robhudson/django-debug-toolbar

Page 61: You've done the Django Tutorial, what next?

command extensionshttp://code.google.com/p/django-command-extensions/

Page 62: You've done the Django Tutorial, what next?
Page 63: You've done the Django Tutorial, what next?
Page 64: You've done the Django Tutorial, what next?
Page 65: You've done the Django Tutorial, what next?
Page 66: You've done the Django Tutorial, what next?

arecibohttp://areciboapp.com

(disclaimer)

Page 67: You've done the Django Tutorial, what next?

Fin. Questions?

Andy McKayClearwind Consulting

@clearwind