Qiang Blog

Just another zhangjingqiang's blog.

Django Workflow


  • Within a new directory, create and activate a new virtualenv.
  • Install Django.
  • Create your project: django-admin.py startproject
  • Create a new app: python manage.py startapp
  • Add your app to the INSTALLED_APPS tuple.

Add Basic URLs and Views

  • Map your Project’s urls.py file to the new app.
  • In your App directory, create a urls.py file to define your App’s URLs.
  • Add views, associated with the URLs, in your App’s views.py; make sure they return a HttpResponse object. Depending on the situation, you may also need to query the model (database) to get the required data back requested by the end user.

Templates and Static Files

  • Create a templates and static directory within your project root.
  • Update settings.py to include the paths to your templates.
  • Add a template (HTML file) to the templates directory. Within that file, you can include the static file with - {% load static %} and {% static "filename" %}. Also, you may need to pass in data requested by the user.
  • Update the views.py file as necessary.

Models and Databases

  • Update the database engine to settings.py (if necessary, as it defaults to SQLite).
  • Create and apply a new migration.
  • Create a super user.
  • Add an admin.py file in each App that you want access to in the Admin.
  • Create your models for each App.
  • Create and apply a new migration. (Do this whenever you make any change to a model).


  • Create a forms.py file at the App to define form-related classes; define your ModelForm classes here.
  • Add or update a view for handling the form logic - e.g., displaying the form, saving the form data, alerting the user about validation errors, etc.
  • Add or update a template to display the form.
  • Add a urlpattern in the App’s urls.py file for the new view.

User Registration

  • Create a UserForm
  • Add a view for creating a new user.
  • Add a template to display the form.
  • Add a urlpattern for the new view.

User Login

  • Add a view for handling user credentials.
  • Create a template to display a login form.
  • Add a urlpattern for the new view.

Setup the template structure

  • Find the common parts of each page (i.e., header, sidebar, footer).
  • Add these parts to a base template
  • Create specific. templates that inherent from the base template.


Real Python Part 2

django workflow

The Next Generation Website Workflow

Phase0 | The Given Condition 与件整理
Phase1 | Current Status Analysis 現状把握
Phase2 | Target Setting 目標の明確化
Phase3 | The User Experience ユーザ体験シナリオ
Phase4 | Strategic Planning 戦略策定
Phase5 | Tactics Planning 戦術策定
Phase6 | Contents Design コンテンツ制作
Phase7 | Prototyping Website Design サイト設計
Phase8 | Prototyping System Design システム設計
Phase9 | Development 開発・制作・テスト
Phase10 | Data Injection データ投入
Phase11 | Operation & Management PDCA サイクル
Plan, Do, Check, Action




  • 1.从需求明确必要的功能。
  • 2.从功能明确必要的页面。
  • 3.制作页面。
  • 4.实现功能。
  • 5.连接页面和功能。
  • 6.确认运行效果。
  • 7.完成。


  • 1.要件から必要な機能を明らかにする。
  • 2.機能から必要な画面を明らかにする。
  • 3.画面を作る。
  • 4.機能を作る。
  • 5.画面に機能を組み込む。
  • 6.動作を確認する。
  • 7.完成。