agile-web-dev-django

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Notes on slide 1

    Use symlink to Python path if you use the bleeding edge version

    Database supported in django out of the box: * MySQL * SQLLite * Postgres * Oracle # database_name / Or path to database file if using sqlite3. # database_user Not used with sqlite3.

    Favorites, Groups & Events

    agile-web-dev-django - Presentation Transcript

    1. Agile Web Development with Django October 1st, 2009 South Coast Linux User Group Joshua Partogi http://scrum8.com http://twitter.com/scrum8
    2. About Me
      • Java programmer by profession
      • Web developer hobbyist
    3. How I got here
      • 1) I want to have an online web that I can play with during my freetime
      • 2) I want to deploy my webapp/website on a cheap VPS
      • 3) Java is too expensive to deploy on standard VPS plan
      • 4) PHP is just so messy for long term development
      • 5) Ruby on Rails is good but it's on steroids
    4. What is django?
      • It is a web framework for perfectionists with deadline
      • It came out of online publishing world in Lawrence, Kansas
      • For that reason, it gain popularity (mostly) in journalism world
      • It is made with python, a really clean multi-paradigm dynamic language
      • An opiniated (but flexible) web framework for online publishing system that gears web developers towards fast-moving changes
    5. Opiniated framework is good. If your have the same opinions about how a framework should be, you will most likely like that framework django is opiniated towards online newspaper site
    6. Why django?
      • 1) Comprehensive documentation
      • Everybody on the net just praise about it
      • 2) No rocket science, really simple
      • 3) Many built-in features
      • Mainly the admin system
      • 4) Reusable software concept
      • Plug and play one application accross many other django projects
      • Build many small applications, not monolithic gigantic applications
    7. Get django
      • 1) sudo python setup.py install
      • 2) The bleeding edge version:
      • http://code.djangoproject.com/svn/django/trunk/
    8. Let's see some code!
    9. Create django project
      • django-admin.py startproject myblog
    10. Create django app
      • python manage.py startapp blog
    11. Install django app
      • settings.py
      • INSTALLED_APPS = (
      • 'django.contrib.admin',
      • 'myblog.blog',
      • )
    12. Modify DB config
      • settings.py
      • DATABASE_ENGINE = 'sqlite3'
      • DATABASE_NAME = 'myblog'
      • DATABASE_USER = ''
      • DATABASE_PASSWORD = ''
    13. Create model
      • models.py
      • from django.db import models
      • from django.contrib.auth.models import User
      • class Entry(models.Model):
      • title = models.CharField(max_length=128)
      • content = models.TextField()
      • slug = models.SlugField(max_length=128)
      • created = models.DateTimeField(auto_now_add=True)
      • def get_absolute_url(self):
      • return "/%s/%s/" % (self.created.strftime("%Y/%m/%d"), self.slug)
    14. Generate tables
      • python manage.py syncdb
    15. Activate admin
      • urls.py
      • from django.contrib import admin
      • admin.autodiscover
      • urlpatterns = patterns('',
      • (r'^admin/', include(admin.site.urls)),
      • )
    16. Create admin
      • admin.py
      • from django.contrib import admin
      • from myblog.blog.models import Entry
      • class EntryAdmin(admin.ModelAdmin):
      • date_hierarchy = 'created'
      • list_filter = ('created',)
      • list_display = ('title', 'created')
      • admin.site.register(Entry, EntryAdmin)
    17. Design URL
      • urls.py
      • urlpatterns = patterns('',
      • (r'^$', 'myblog.blog.views.list'),
      • )
    18. Create views
      • views.py
      • from django.template import RequestContext
      • from django.shortcuts import render_to_response
      • from myblog.blog.models import Entry
      • def list(request):
      • entries = Entry.objects.all()
      • return render_to_response('blog/list.html',{
      • 'entries': entries,
      • 'request': request
      • }, context_instance=RequestContext(request))
    19. Set template directory
      • settings.py
      • import os
      • ROOT_PATH = os.path.realpath(os.path.dirname(__file__))
      • TEMPLATE_DIRS = (
      • os.path.join(ROOT_PATH, 'templates'),
      • )
    20. Create templates
      • In templates/blog/list.html
      • {% for entry in entries %}
      • <div><a href=&quot;{{ entry.get_absolute_url }}&quot;>
      • {{ entry.title }}</a>
      • posted on: {{ entry.created|date:&quot;D d M Y&quot; }}
      • </div>
      • <div>{{ entry.content }}</div>
      • {% endfor %}
    21. MTV Concept
      • Models
      • domain spesific representation of the data on which the application operates
      • Template
      • how the data that is delegated from the view is presented
      • Views
      • describes the data that gets presented to the user (which data is presented)
    22. Deployment
      • 1) Dynamic processing
      • a) mod_python
      • b) mod_wsgi
      • c) fastcgi
      • 2) Static pages
      • a) Apache
      • b) lighttpd
      • c) nginx
    23. Database support
      • 1) MySQL
      • 2) Postgresql
      • 3) SQLite
      • 4) Oracle
      • 5) SQL Server http://code.google.com/p/django-mssql/
      • 6) IBM DB2 http://code.google.com/p/ibm-db/
    24. Other cool stuff
      • 1) commenting system
      • 2) feeds system
      • 3) generic view
    25. Pre-made django project
      • Pinax Project: Content Management System
      • http://pinaxproject.com/
      • Satchmo Project: Online cart system
      • http://satchmoproject.com
    26. Sites using it
      • http://www.washingtontimes.com/
      • http://www.torontolife.com/
      • http://bitbucket.org/
      • http://www.tabblo.com/
    27. My django apps
      • Online site
      • http://scrum8.com
      • Simple weblog
      • http://blog.scrum8.com
      • Free listing job board
      • http://jobs.scrum8.com
      • Other stuffs
      • http://github.com/scrum8
    28. Django is not a silver bullet
    29. But it's really helpful to build a website quickly
    30. Resources
      • Documentations
      • http://docs.djangoproject.com/
      • Books
      • http://www.djangobook.com/en/2.0/
      • Mailing lists
      • [email_address]
      • [email_address]
    31. Thank You! [email_address] http://slideshare.net/jpartogi

    + Joshua PartogiJoshua Partogi, 2 months ago

    custom

    337 views, 0 favs, 2 embeds more stats

    A presentation on django that I share at South Coas more

    More info about this document

    CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

    Go to text version

    • Total Views 337
      • 264 on SlideShare
      • 73 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 1
    Most viewed embeds
    • 72 views on http://blog.scrum8.com
    • 1 views on http://localhost:8000

    more

    All embeds
    • 72 views on http://blog.scrum8.com
    • 1 views on http://localhost:8000

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags