130 likes | 217 Views
Web Development Methodologies. Yuan Wang(yw2326). Basic Concepts. Browser/Server (B/S) Structure Keywords: Browser, Server Examples: Websites Client/Server (C/S) Structure Keywords: Client, Server Examples: MSN, Skype. Model-View-Controller(MVC). Basic Process of a B/S application:
E N D
Web Development Methodologies Yuan Wang(yw2326)
Basic Concepts • Browser/Server (B/S) Structure • Keywords: Browser, Server • Examples: Websites • Client/Server (C/S) Structure • Keywords: Client, Server • Examples: MSN, Skype
Model-View-Controller(MVC) • Basic Process of a B/S application: • A user wants to look at a page using a browser.He sends a request to the server, then logical codes on the server begin to execute based on the user’s request. They get some data from database and do some logical execution, then return a dynamic page to the web browser so that the user can see it. • Page: View • Logical Codes: Controller • Model: Database
Technologies in B/S development • Technologies in View tier: • HTML, Javascript(JS), CSS, etc. • JS: A scripting language, using in the browser-side • Libraries: Yahoo User Interface, EXT, Prototype, JQuery • CSS: DIV+CSS instead of <table> • <div id=page class=“decoration”> </div> • Clear, Easier to change an interface apperance
Frameworks • Why it appears • CGI, JSP, ASP Mix 3 tiers together • Simple, easy to learn • Not easy to extend • There are really a lot of frameworks, which one we need to choose?
Frameworks • 1. ASP.NET using C# • Not totally free • 2. Struts in J2EE platform using Java • Difficult, too many codes to write • 3. Some other frameworks using PHP, Perl • Not very powerful
Is there a language and a framework • Free • Easy • Powerful • Python • Python on Django • http://www.djangoproject.com/
Python on Django • Model-Template-View(MTV) • Template: describes how the data is presented • Template: View in MVC • View: describes which data is presented • View: Controller in MVC • URL matches one controller in Django • Other MVC matches one view, such as .asp, .jsp
How to use it • Django-admin.py in Python site-packages • Using django-admin.py startproject newproject to create a directory for your application • Settings.py and urls.py • Settings: configuration file • tell Django where you put your pages in • Template_Dirs = { ./templates } • Helloworld.html---print helloworld--page • Urls: tell Django Server which controller each url matches
How to use it • Create a controller file called Helloworld.py • From django.shortcuts import render_to_response • def index(request): • return render_to_response(“helloworld.html”) • Add it into urls.py: • Urlpatterns= patterns(‘’, • (r’^helloworld/’, ‘newproject.helloworld.index’), • ) • Then when you input http://localhost:8080/helloworld/ • It will match function index in helloworld.py
Test on Django • Start Django Server • In the command line, • C:\python25\newproject>manage.pyrunserver • http://localhost:8080/helloworld/
Remember Multidisciplinary field