User:Yrathor: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(Created page with "=='''Web.py Introduction'''== Web.py is a [https://en.wikipedia.org/wiki/Free_and_open_source free and open source] [https://en.wikipedia.org/wiki/Web_application_framework web a...")
 
No edit summary
Line 2: Line 2:
Web.py is a [https://en.wikipedia.org/wiki/Free_and_open_source free and open source] [https://en.wikipedia.org/wiki/Web_application_framework web application framework] that is as simple as it is powerful. Web.py was originally published while Aaron swartz worked at [http://reddit.com/ reddit.com], where the site used it ass it grew to become one of the top 1000 sites according to Alexa and served millions of daily page views. "It's the anti-framework framework. web.py doesn't get in your way." explained founder Steve Huffman.
Web.py is a [https://en.wikipedia.org/wiki/Free_and_open_source free and open source] [https://en.wikipedia.org/wiki/Web_application_framework web application framework] that is as simple as it is powerful. Web.py was originally published while Aaron swartz worked at [http://reddit.com/ reddit.com], where the site used it ass it grew to become one of the top 1000 sites according to Alexa and served millions of daily page views. "It's the anti-framework framework. web.py doesn't get in your way." explained founder Steve Huffman.


The web.py slogan is: "Think about the ideal way to write a web app. Write the code to make it happen.". The goal of web.py is to build the ideal way to make web apps. In web.py, Instead of exposing Python objects, it allows you to build HTTP responses. Instead of trying to make the database look like an object, web.py makes the database easier to use. And instead of coming up with yet another way to write HTML, the web.py template system tries to bring Python into HTML.
The web.py slogan is: "Think about the ideal way to write a web app. Write the code to make it happen.". The goal of web.py is to build the ideal way to make web apps. In web.py, Instead of exposing Python objects, it allows you to build HTTP responses. Instead of trying to make the database look like an object, web.py makes the database easier to use. And instead of coming up with yet another way to write [https://en.wikipedia.org/wiki/HTML HTML], the web.py template system tries to bring Python into HTML.


Some of the sites which uses web.py are
Some of the sites which uses web.py are
Line 9: Line 9:
* [http://makehistory.national911memorial.org/ Make History], a project of the 9/11 memorial museum.
* [http://makehistory.national911memorial.org/ Make History], a project of the 9/11 memorial museum.


==Python==
=='''Python'''==
* [[Grading]]
 
Python is a [https://en.wikipedia.org/wiki/Multi-paradigm_programming_language multi-paradigm programming language]: object-oriented programming and [https://en.wikipedia.org/wiki/Structured_programming structured programming] are fully supported, and there are a number of language features which support functional programming and aspect-oriented programming (including by [https://en.wikipedia.org/wiki/Metaprogramming metaprogramming]). Python uses [https://en.wikipedia.org/wiki/Dynamic_typing dynamic typing] and a combination of reference counting and a cycle-detecting garbage collector for [https://en.wikipedia.org/wiki/Memory_management memory management]. An important feature of Python is dynamic [https://en.wikipedia.org/wiki/Name_resolution_(programming_languages) name resolution], which binds method and variable names during program execution.
 
Ruby's creator, Yukihiro Matsumoto, has said: "I wanted a scripting language that was more powerful than Perl, and more object-oriented than '''Python'''. That's why I decided to design my own language."
 
The world of Python web frameworks is full of choices. Django, Flask, Pyramid, Tornado, Bottle, Diesel, Pecan, Falcon, web.py, web2py and many more are competing for developer mindshare. The developer needs to cut the options down to one framework depending on the type of application.
 
=='''Why Web.py?'''==
 
The reasons for using web.py are
* Simplicity
* Freedom
* writing clean code
* minimalism
* a solid web framework


=='''Installation'''==
=='''Installation'''==
Line 16: Line 30:
* Firstly, download the following tar file:
* Firstly, download the following tar file:
  wget http://webpy.org/static/web.py-0.37.tar.gz
  wget http://webpy.org/static/web.py-0.37.tar.gz
* Extract the downloaded tar file
* Extract the downloaded tar file:
  tar -zxvf web.py-0.37.tar.gz
  tar -zxvf web.py-0.37.tar.gz
* tar -zxvf web.py-0.37.tar.gz
* Go to web.py-0.37 directory:
  cd web.py-0.37/
  cd web.py-0.37/
* Install and make it accessible to all the applications
* Install and make it accessible to all the applications:
  sudo python setup.py install
  sudo python setup.py install


==Features of web.py==
=='''Features of web.py'''==
 
''web.py has two interesting features''
 
===Databases===


''Expertiza now has a Java dependency, so the machine you are using to develop Expertiza on should have the JVM installed.''
The database package lets you access various of different databases. Accessing different databases refers to connecting to multiple databases. However, its not an [https://en.wikipedia.org/wiki/Object-relational_mapping ORM]. This feature is missing in [https://en.wikipedia.org/wiki/Django_(web_framework) Django] (another web framework) from long time. This feature is helpful for the people who are good at SQl and don't like to use SQL as it is similar to sqlite3 package but doesn't use ORM.


* [[Setting Up a Development Machine]]
===Forms===
* [[Creating a Linux Development Environment for Expertiza - Installation Guide]]
 
* [[Using git and github for projects]]
A forms package is present in web.py which let's us create forms and validators. Ironically, it doesn't have built-in protection against [https://en.wikipedia.org/wiki/Cross-site_request_forgery CSRF]. If you want to create a login form, you can use forms package to create.
* [[Using heroku to deploy your projects]]
 
* [[How to Begin a Project from the Current Expertiza Repository]]
Another interesting feature about web.py is its flexibility. It has flexible modules which can be used with another framework.
* [[Git]]
* [[How to Change a User's Password on a Development Machine]]
* [[Debugging Rails]]


==Hello world example==
==Hello world example==
* [[Deploying to Production]]
<pre>
* [[Downloading Production Data]]
import web
* [[Accessing the Production Server]]
urls = (
'/', 'index'
)
 
class index:
def GET(self):
return "Hello, ECE 517!"
 
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()
</pre>


==Conclusion==
==Conclusion==
* [[Using Cucumber with Expertiza]]
 
* [[Rails Testing Overview]]
The philosophy of Web.py -- a minimalist framework -- is not to abstract away the details of interacting with the Web, but to make that interaction easier. As a result, you'll find yourself writing HTTP GET function handlers directly. Likewise, the Web.py database system does not abstract away SQL; rather than hide the fact that you're querying a database, it hides the details of working with different databases. Web.py does define a template language, which -- like that of Web2py -- lets you embed arbitrary Python code in a Web page. Web.py is ideal if you're already familiar with building Web applications (perhaps you once wrote CGI-based applications). You'll get started quickly with Web.py, but you'll have to rely on your own wits to go beyond simple Web applications.
* [[Expertiza Continuous Integration]]


==References==
==References==
[[#References|[1]]] python development story: http://faruk.akgul.org/blog/python-development-story-why-webpy/
[[#References|[2]]] pillars of python-six web frameworks: http://www.infoworld.com/article/2622836/application-development/pillars-of-python--six-python-web-frameworks-compared.html?page=2
[[#References|[3]]] Django vs flash vs pyramid https://www.airpair.com/python/posts/django-flask-pyramid
* [[Object-Oriented Design and Programming]]
* [[Object-Oriented Design and Programming]]

Revision as of 09:40, 5 February 2016

Web.py Introduction

Web.py is a free and open source web application framework that is as simple as it is powerful. Web.py was originally published while Aaron swartz worked at reddit.com, where the site used it ass it grew to become one of the top 1000 sites according to Alexa and served millions of daily page views. "It's the anti-framework framework. web.py doesn't get in your way." explained founder Steve Huffman.

The web.py slogan is: "Think about the ideal way to write a web app. Write the code to make it happen.". The goal of web.py is to build the ideal way to make web apps. In web.py, Instead of exposing Python objects, it allows you to build HTTP responses. Instead of trying to make the database look like an object, web.py makes the database easier to use. And instead of coming up with yet another way to write HTML, the web.py template system tries to bring Python into HTML.

Some of the sites which uses web.py are

  • Frinki, a new social network in spanish.
  • oyster.com, a website that reviews hotels uses web.py for the entire website.
  • Make History, a project of the 9/11 memorial museum.

Python

Python is a multi-paradigm programming language: object-oriented programming and structured programming are fully supported, and there are a number of language features which support functional programming and aspect-oriented programming (including by metaprogramming). Python uses dynamic typing and a combination of reference counting and a cycle-detecting garbage collector for memory management. An important feature of Python is dynamic name resolution, which binds method and variable names during program execution.

Ruby's creator, Yukihiro Matsumoto, has said: "I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python. That's why I decided to design my own language."

The world of Python web frameworks is full of choices. Django, Flask, Pyramid, Tornado, Bottle, Diesel, Pecan, Falcon, web.py, web2py and many more are competing for developer mindshare. The developer needs to cut the options down to one framework depending on the type of application.

Why Web.py?

The reasons for using web.py are

  • Simplicity
  • Freedom
  • writing clean code
  • minimalism
  • a solid web framework

Installation

To install web.py,

  • Firstly, download the following tar file:
wget http://webpy.org/static/web.py-0.37.tar.gz
  • Extract the downloaded tar file:
tar -zxvf web.py-0.37.tar.gz
  • Go to web.py-0.37 directory:
cd web.py-0.37/
  • Install and make it accessible to all the applications:
sudo python setup.py install

Features of web.py

web.py has two interesting features

Databases

The database package lets you access various of different databases. Accessing different databases refers to connecting to multiple databases. However, its not an ORM. This feature is missing in Django (another web framework) from long time. This feature is helpful for the people who are good at SQl and don't like to use SQL as it is similar to sqlite3 package but doesn't use ORM.

Forms

A forms package is present in web.py which let's us create forms and validators. Ironically, it doesn't have built-in protection against CSRF. If you want to create a login form, you can use forms package to create.

Another interesting feature about web.py is its flexibility. It has flexible modules which can be used with another framework.

Hello world example

import web
urls = (
	'/', 'index'
	)

class index:
	def GET(self):
		return "Hello, ECE 517!"

if __name__ == "__main__":
	app = web.application(urls, globals())
	app.run()

Conclusion

The philosophy of Web.py -- a minimalist framework -- is not to abstract away the details of interacting with the Web, but to make that interaction easier. As a result, you'll find yourself writing HTTP GET function handlers directly. Likewise, the Web.py database system does not abstract away SQL; rather than hide the fact that you're querying a database, it hides the details of working with different databases. Web.py does define a template language, which -- like that of Web2py -- lets you embed arbitrary Python code in a Web page. Web.py is ideal if you're already familiar with building Web applications (perhaps you once wrote CGI-based applications). You'll get started quickly with Web.py, but you'll have to rely on your own wits to go beyond simple Web applications.

References

[1] python development story: http://faruk.akgul.org/blog/python-development-story-why-webpy/

[2] pillars of python-six web frameworks: http://www.infoworld.com/article/2622836/application-development/pillars-of-python--six-python-web-frameworks-compared.html?page=2

[3] Django vs flash vs pyramid https://www.airpair.com/python/posts/django-flask-pyramid