Your SlideShare is downloading. ×
Software Project Management
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Software Project Management

916
views

Published on

Easy (Web) Software Project Development & Managegement with Django and Mercurial

Easy (Web) Software Project Development & Managegement with Django and Mercurial


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
916
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
48
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Easy Web Project Development and Management with Django & Mercurial Widoyo <widoyo@gmail.com>
  • 2. Why?
    • MVC = Model View Controller
    • Django > MTV = Model Template View
    • Many software developer does not track their code
  • 3. The Project
    • Human Resource Management Software (simplified)
    • Web base application
    • 100% using Open Source Software
    • Source Code are well Manage
  • 4. HRM Data to Cover
    • HR Data {Nama, Alamat, Hp, Lahir, email, masuk}
    • Training {judul, mulai, akhir, kota}
  • 5. Open Source Software
    • Ubuntu Desktop + Server 8.04.2
    • Python 2.5.2
    • Django 1.0.final
    • Sqlite 3.4.2
    • Mercurial DSCM 0.9.5
  • 6. Ubuntu
    • Linux for human being
    • LTS = Long Term Support (5 year)
    • Latest = 9.04 (9 means 2009, 04 means April)
    • Varian
      • Desktop
      • Server
      • Netbook Remix
  • 7. Python
    • Python is a dynamic object-oriented programming language that can be used for many kinds of software development. ... and can be learned in a few days . Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code .
    • &quot; Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. ...”
  • 8. Django
    • The web framework for perfectionists with deadline
    • Python base web framework
    • http://djangoproject.com
    • http://djangobook.com
    • http://djangoinstant.com
  • 9. SQlite
    • SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world.
    • http://sqlite.org
  • 10. Mercurial
    • a fast, lightweight Source Control Management system designed for efficient handling of very large distributed projects.
    • http://selenic.com/mercurial
  • 11. Install
    • Come with Ubuntu:
      • Python 2.5.2 (default), Sqlite3
      • Mercurial
        • $sudo apt-get install mercurial
    • Django
      • Download django-<ver>.tar.gz
      • $tar -vzxf django-<ver>.tar.gz
      • $cd django-ver
      • $sudo python setup.py install
  • 12. Let's Start
    • Project skeleton
      • $django-admin.py startproject hrapp
      • $cd hrapp
      • $python manage.py runserver (test It Worked!)
      • $chmod 755 manage.py
      • $gvim settings.py (for Database & django.contrib.admin)
      • $./manage.py syncdb (populate database & create super user)
  • 13. Creating Application
    • Creating Application
      • $./manage.py startapp apps
    • Creating Models
      • Person {Nama, Alamat, Hp, Lahir, email, masuk}
      • $gvim apps/models.py
      • Activating application & generating table
      • $gvim settings.py (install 'apps' into INSTALLED_APPS)
      • $./manage.py syncdb
  • 14. Files
    • apps/models.py
    • from django.db import models
    • class Person(models.Model):
    • nama = models.CharField(max_length=50)
    • alamat = models.CharField(max_length=200)
    • hp = models.CharField(max_length=35, blank=True, null=True)
    • lahir = models.DateField()
    • masuk = models.DateField()
    • settings.py
    • DATABASE_ENGINE = 'sqlite3'
    • DATABASE_NAME = '/tmp/hrapp.db'
    • .
    • .
    • .
    • INSTALLED_APPS = (
    • .
    • 'django.contrib.admin',
    • 'hrapp.apps',
    • )
  • 15. Activating 'admin' Interface
    • $gvim urls.py
      • from django.contrib.admin import admin
      • admin.autodiscover()
      • .
      • .
      • (r'^admin/(.*)', admin.site.root),
    • $gvim apps/admin.py (to manage Person Data)
      • from hrapp.apps.models import Person
      • from django.contrib import admin
      • class PersonAdmin(admin.ModelAdmin):
      • list_display = ['nama', 'alamat','hp','masuk','lahir']
      • admin.site.register(Person, PersonAdmin)
  • 16. Check-in Into Repository
    • $hg init
    • $hg add
    • $hg commit –m -'Initial project'
  • 17. Creating Training Data Model
    • apps/models.py
      • class Training(models.Model):
      • person = models.ForeignKey(Person)
      • judul = models.CharField(max_length=200)
      • mulai = models.DateField()
      • akhir = models.DateField()
      • kota = models.CharField(max_length=35)
    • $./manage.py syncdb
    • Check-in repository
      • $hg commit
  • 18. Creating 'admin' for Training
    • Training inline to Person
    • $gvim apps/admin.py
      • from hrapp.apps.models import Person, Training
      • ...
      • class TrainingInline(admin.StackedInline):
      • model = Training
      • extra = 3
      • class PersonAdmin(admin.ModelAdmin):
      • list_display = ['nama', 'alamat','hp','masuk','lahir']
      • inlines = [TrainingInline]
      • ...
  • 19. Customize Admin
    • Adding 'search'
    • Adding 'filter'
    • apps/admin.py
      • search_fields = ['nama']
      • list_filter = ['kota']
    • $hg commit
  • 20. Public Interface: Homepage
    • Homepage
      • $gvim urls.py
        • from hrapp.apps.views import homepage
        • (r'^$', homepage)
      • $gvim apps/views.py
        • from django.http import HttpResponse
        • def homepage(request):
        • return HttpResponse(“Hello RICE Expo”)
    • $hg commit
  • 21. Public Interface: Person Data
    • List
      • $gvim urls.py
        • from django.shortcuts import render_to_response
        • from hrapp.apps.views import homepage, person_list
        • (r'^person/', person_list)
      • $gvim apps/views.py
        • from django.http import HttpResponse
        • def person_list(request):
        • person_list = Person.objects.all()
        • return render_to_response('person_list.html', {'person_list': person_list})
      • $gvim templates/person_list.html
        • <table>
        • {% for person in person_list %}
        • <tr><td>{{ person.nama }}</td><td>{{ person.alamat }}</td></tr>
        • {% endfor %}
        • </table>
  • 22. Person Data
    • Detail
      • $gvim urls.py
        • from hrapp.apps.views import homepage, person_list, person_detail
        • (r'^person/', person_list),
        • (r'^person/(?P<object_id>)/$', person_detail),
      • $gvim apps/views.py
        • def person_detail(request, object_id):
        • person = Person.objects.get(id=object_id)
        • return render_to_response('person_detail.html', {'person': person})
      • $gvim templates/person_detail.html
        • <h1>{{ person.nama }}</h1>
        • <i>{{ person.alamat }}</i>
        • {% if person.training_set.all %}<ol>
        • {% for training in person.training_set.all %}<li>{{ training.judul }}<li>{% endfor %}</ol>
        • {% else %}
        • <p>Belum ada riwayat training</p>
        • {% endif %}
  • 23. Django Pattern
    • Urls >> View (method) >> Template
    • URLConf
      • Loose coupling
      • Mapping between url and method to execute
  • 24. Better Page Layout
    • Creating and applying template
  • 25. Mercurial
    • Viewing change log
  • 26. Terima kasih
    • Widoyo <widoyo@gmail.com>