Moving to a Sustainable Web Development Environment for Library Web Applications

Similar documents
MIT AITI Python Software Development Lab DJ1:

Django: Views, Templates, and Sessions

Reminders. Full Django products are due next Thursday! CS370, Günay (Emory) Spring / 6

Django Admin Sortable Documentation

Technology modeling. Ralf Lämmel Software Languages Team University of Koblenz-Landau

django-scaffold Documentation

Webdev: Building Django Apps. Ryan Fox Andrew Glassman MKE Python

Django urls Django Girls Tutorial

The Django Web Framework Part II. Hamid Zarrabi-Zadeh Web Programming Fall 2013

정재성

django-audiofield Documentation

django-cms-search Documentation

Tomasz Szumlak WFiIS AGH 23/10/2017, Kraków

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Django

alphafilter Documentation

CE419 Web Programming. Session 15: Django Web Framework

django-generic-filters Documentation

The Definitive Guide to Django

Ninja Typers Web Application Design Document By Marvin Farrell C

DJOAuth2 Documentation

Django Image Tools Documentation

django-baton Documentation

Lecture 10(-ish) Web [Application] Frameworks

generates scaffolding/framework for models, views

django-baton Documentation

django-photologue Documentation

Hue Application for Big Data Ingestion

django simple pagination Documentation

django-openid Documentation

CSCI 1320 Creating Modern Web Applications. Content Management Systems

django-ad-code Documentation

MIT Global Startup Labs México 2013

Django Part II SPARCS 11 undead. Greatly Inspired by SPARCS 10 hodduc

django-password-reset Documentation

django-model-report Documentation

The Django Web Framework Part VI

Django by errors. Release 0.2. Sigurd Gartmann

DjNRO Release September 30, 2014

Django Phantom Theme Documentation

Flask-MongoEngine Documentation

django-intranet Documentation

Graphene Documentation

Django_template3d Documentation

29-27 May 2013 CERN WEB FRAMEWORKS. Adrian Mönnich

widgets, events, layout loosely similar to Swing test browser, or plugin for testing with real browser on local system

Easy-select2 Documentation

Pixelsilk Training Manual 8/25/2011. Pixelsilk Training. Copyright Pixelsilk

Django-Style Flask. Cody Lee SCALE12x Feb 22, git clone

Django PAM Documentation

django_podcasting Documentation

web.py Tutorial Tom Kelliher, CS 317 This tutorial is the tutorial from the web.py web site, with a few revisions for our local environment.

LFC - Lightning Fast CMS Documentation

Accelerating Information Technology Innovation

wagtailmenus Documentation

South Africa Templates.

Linguistic Architecture

Working with the Seagull Framework. By Demian Turner, Seagull Systems

Accelerating Information Technology Innovation

Writing a Django e- commerce framework OSCON 2012

Django Web Framework: A Comprehensive Introduction and Step by Step Installation

SAURASHTRA UNIVERSITY

Creating a System for the Online Delivery of Oral History Content

Django REST Framework JSON API Documentation

django-sekizai Documentation

Zope and RDBMS. A beginner's guide to working with relational databases from Zope. EuroPython Conference 2007 Vilnius, Lithuania.

Django MFA Documentation

Technology modeling. Ralf Lämmel Software Languages Team University of Koblenz-Landau

Django Extra Views Documentation

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul

ganetimgr Documentation

Django Standalone Apps

MapEntity Documentation

staff Documentation Release 1.2

kiss.py Documentation

cmsplugin-blog Release post 0 Øyvind Saltvik

djangotribune Documentation

Tangent MicroServices Documentation

CS50 Quiz Review. November 13, 2017

DIGIT.B4 Big Data PoC

Django design patterns Documentation

canary Documentation Release 0.1 Branton K. Davis

Software Test Plan Version 1.0

Django Dynamic Fields Documentation

Front End Programming

wagtailmenus Documentation

Django-frontend-notification Documentation

django-amp-tools Documentation Release latest

Real Life Web Development. Joseph Paul Cohen

Django Deployment & Tips daybreaker

Django starting guide

Django File Picker Documentation

fragapy Documentation

SAURASHTRA UNIVERSITY

kaleo Documentation Release 1.5 Eldarion

Django EL(Endless) Pagination Documentation

Everyone Has an (E)Book in Them: Teaching a Create Your Own Ebook Class

(p t y) lt d. 1995/04149/07. Course List 2018

Django File Picker Documentation

CIS192 Python Programming

The Pyramid Web Application Development Framework

Transcription:

Portland State University PDXScholar Online Northwest Online Northwest 2010 Feb 5th, 9:00 AM - 11:00 AM Moving to a Sustainable Web Development Environment for Library Web Applications Anjanette Young University of Washington Let us know how access to this document benefits you. Follow this and additional works at: https://pdxscholar.library.pdx.edu/onlinenorthwest Young, Anjanette, "Moving to a Sustainable Web Development Environment for Library Web Applications" (2010). Online Northwest. 16. https://pdxscholar.library.pdx.edu/onlinenorthwest/2010/presentations/16 This Panel Session is brought to you for free and open access. It has been accepted for inclusion in Online Northwest by an authorized administrator of PDXScholar. For more information, please contact pdxscholar@pdx.edu.

Moving to a sustainable web development environment for library web applications.

Agenda 1. Background about our Department 2. Theory of Application Design. MVC, MTV 3. Benefits of porting to Django 4. Case Study: PCAD (Some coding talk) 5. Other projects ported to Django.

Django Rocks!

Agenda Why does Django Rock? How can we rock with Django? BSD Daemon Copyright 1988 by Marshall Kirk McKusick.All Rights Reserved.

Django rocks... because it makes maintenance and development of web applications less esoteric. 'Southern Cult Solar Cross', Jay Carriker, JCarriker, Wikipedia. Creative Commons Attribution-Share Alike 2.5 Generic

Django rocks... because programmers and developers actually want to learn to use the framework.

Django rocks... because it implements the Model-View-Controller Application Design Pattern, sanely.

Django rocks... because their documentation rocks. grows as a single versioned entity. clearly states the version of Django that the page references. contains their design philosophy, best practices, new features in that version. Django Book.

Django rocks... because it decreases the amount of useless knowledge in my head. David J. Fred, Dfred, Wikipedia. Creative Commons Attribution-Share Alike 2.5 Generic

How to rock with Django Porting Apps. No cycle of Learning -> Forgetting -> Relearning. No re-write of the entire application. Minimal changes to the existing database.

Django is CRUD + Create new records Read existing records Update existing records Delete existing records Browse List Detailed Record View Sortable Columns Pagination Simple Search

Port to Django? 1. Projects with simple Authorization requirements. 2. Projects with simple workflow. 3. Projects with simple database schemas. *Django is great as a base for complex applications. Complexity will require code.

Pacific Coast Architecture Database 1. Simple authentication and authorization needs. 2. Frequent requests for changes to data fields 3. Frequent requests for additional data fields. 4. Frequent requests for new features. 5. Fairly simple database schema.

MTV Model - Template - View (and URLConf)

Google Sites - Task List

Creating the Models 1. Clean the existing database. 2. Run inspectdb - creates models.py 3. Clean resulting models.py file. 4. Run syncdb - creates rest of the db tables. $ python manage.py inspectdb > models.py inspectdb is a Django tool that roughly translates an existing database into Django Models.

Cleaning up the Database Before running inspectdb: 1. All Primary Keys are named 'id'. 2. All Foreign Keys are named '[tablename]_id' 3. If using Postgresql, name all sequences: '[tablename]_id_seq'

Cleaning up models.py After running inspectdb: 1. PK field types from IntegerField to AutoField. 2. Re-Order Classes so FK's refer to Classes that already exist. 3. Add missing FK's and ManyToMany Fields. As a general rule, place FK's in the Classes/Objects in which they will most logically be found.

Django rocks... because it creates all the CRUD for you. Create - Detailed Record Form Read - Browse List + Detailed Record Update - Populated Detailed Record Form Delete - Browse List + Delete Form

Setup CRUD interface Install and configure the Administration module. 1. Edit settings.py to install. 2. Edit urls.py. Uncomment a couple of lines. 3. Create a file named admin.py Django rocks because of this admin interface. Almost no programmer intervention needed. No Web developer or designer intervention needed.

admin.py - Plain admin.site.register(architect) * Architect is the name of the Model

Admin Module: Default Browse List

admin.py - Fancy class ArchitectAdmin(admin.ModelAdmin): search_fields = ['lastname', 'firstname'] list_display = ('lastname', 'firstname', 'middlename', 'occupation') ordering = ('lastname', 'firstname') list_filter = ('entrydate', 'nationality', 'occupation') admin.site.register(architect, ArchitectAdmin)

Admin Module: Fancy Browse List

Creating Public Views Generic Views "provide easy interfaces to perform the most common tasks developers encounter." 1. Redirect to a different page or render a given template. 2. List and Detail pages for objects. 3. Present date-based objects in year/month/day archive pages, associated detail, and latest pages. http://www.djangobook.com.

Example of simple Generic View architect_list_info = { 'queryset': Architect.objects.all(), }

Detailed Record View

Extended Generic View Bonus Addable parameters to Generic Views. allow_empty context_processors extra_context mimetype paginate_by queryset template_loader template_name template_object_name

Example of extended Generic View architect_list_info = { 'queryset': Architect.objects.all(), 'paginate_by': 50, 'extra_context': {'alphabet': map(chr, range(65, 91))} }

Browse List w/extended Generic View Goodness

View example def architects_alpha_list(request, alpha): architect_alpha_list = Architect.objects.filter(lastname startswith = alpha) return object_list(request, queryset=architect_alpha_list, paginate_by=50, extra_context={'alphabet':map(chr, range(65, 91))})

Django rocks... because it provides Generic Views for Templates. Browse Lists Detailed Records Pagination Easy customization

Create Public Pages: Templates The Django templating language: HTML+ 1. Recognizes all the basic HTML tags. 2. Allows for inclusions and extensions of templates. 3. Contains a large selection of built-in filters for modifying the output of variables and methods 4. Contains programmatic constructs for presentation, but is not actual python. List cribbed from Jeff Croft. http://jeffcroft.com/blog/2007/jan/11/django-and-mtv/

Django Template {% extends 'base.html' %} {% block extrahead %} <script src="/path/to/query.js" type="text/javascript"></script> {% endblock %} {% block title %}PCAD{% endblock %}

Django Template - Generic View {% block content %} <ul> {% for a in object_list %} <li><a href="/architect/architects/{{ a.id }}"> {{a.lastname }}, {{a.firstname}}</a> </li> {% endfor %} </ul> {% else %} <p>no list of Architects available.</p> {% endif %} {% endblock %}

Django Template - Pagination {% if is_paginated %} Page {{ page_obj.number }} of {{ paginator.num_pages }} pages. {% if page_obj.has_previous %} <a href="./?page={{ page_obj.previous_page_number}}"> previous page</a> {% endif %} {% if page_obj.has_next %} <a href="./?page={{ page_obj.next_page_number }}"> next page</a> {% endif %} {% endif %}

Other Projects Myanmar: SQL Server + ASP -> Postgresql + Django Sung Dynasty: SQL Server + ASP -> Postgresql + Django Korean TOC: Flat file + Perl -> Postgresql + Django Digital Registry Form: SQL Server + ASP -> SQL Server + Django ereserves form: SQL Server + ASP -> SQL Server + Django

Why does Django Rock? Django saves time and resources by enabling the delegation of tasks and generalizing the knowledge needed to work with web applications. Django encourages good practices through it's design. Django provides great documentation so you don't have to.

How can we rock with Django? By using the framework for new web application development By porting old applications to the framework. 1. Clean up the database. 2. Run inspectdb to create models.py 3. Edit the Models (the python classes) so that syncdb will actually work. 4. Install and configure the Administrative module. 5. Use Generic Views and Extended Generic Views for public views (to pipe contexts to the Templates.) 6. Install and use Flatpages for static content pages.

Bibliography Jeff Croft, "Django and MTV," http://jeffcroft.com/blog/2007/jan/11/django-andmtv/ "Django appears to be a MVC framework, but you call the Controller the view, and the View the template. How come you don t use the standard names?", Django Documentation: FAQ, http://docs.djangoproject.com/en/dev/faq/general/ "MTV Development Pattern," Django Book, 2ed., http://www.djangobook. com/en/beta/chapter05/#cn16 "Design Philosophies," Django Documentation, http://docs.djangoproject. com/en/dev/misc/design-philosophies/