Python@TW: 會眾| IRC| Planet| 郵件列表| 聯絡我們
修訂版 1 和 39 的差異如下: (間隔 38 版)
2012-01-05 00:46:19 修訂第 1 版
大小: 459
編輯者: keitheis
說明: 加入 Thinker 的手刻四行 hello world
2021-12-29 10:53:49 修訂第 39 版
大小: 4525
編輯者: 106-104-160-248
說明:
這個顏色代表刪除的 這個顏色代表增加的
行號 1: 行號 1:
供初學者參考:
行號 3: 行號 2:
[[Thinker]] 的[[http://pastebin.com/yzy0TjRn|手刻四行 hello world|target="_blank"]]:
行號 5: 行號 3:
{{{#!python
    import BaseHTTPServer
    class handler(BaseHTTPServer.BaseHTTPRequestHandler): pass
    handler.do_GET = lambda x: x.wfile.write('Hello world')
    BaseHTTPServer.HTTPServer(('', 8000), handler).serve_forever()

<<TableOfContents()>>

== 如何開始寫網站應用程式(Web Application) ==
如果你是 [[Python]] 初學者,可先參考 [[Python/第一次用就上手]]。

如果你是網站開發(Web Development)初學者,可參考 Wikipedia 上的[[http://zh.wikipedia.org/wiki/Category:網頁技術|分類:網頁技術]]、[[http://zh.wikipedia.org/zh-tw/Category:網站開發|分類:網站開發]],或用關鍵字「HTML CSS Javascript」搜尋相關資料;當然,這只是網站開發的冰山一角。

通常你可以針對自身的需求、佈署環境、工作環境與團隊來比較各個網站框架(Web Framework),挑一個適合你的選擇。就算真的沒有符合你需求的,自己動手寫一個也不會太難。這也許是人說:「Python 的 Web Framework 比它的關鍵字還多。」的原因。

如果你只是想試一試,沒有什麼需求可言,那就隨便挑一個順眼的。

== 沒有廢話直接開始 ==
[[http://djangogirlstaipei.herokuapp.com/tutorials/|Django Girls 教學手冊 - Django Girls Taipei]]

== 有名的 Python 網站框架 ==
 * [[Django]] 目前為最大宗。
 * Flask(應該是 Pyhton Web Framework 在 Github 上 star 最多的,也就是說,人氣很旺)
 * Pyramid ([[Pylons Project]])(如果你才剛學 Python,不要用!)
 * web2py
 * bottle.py
 * [[Zope]] & [[Plone]](要架 CMS 可以考慮 Plone)

== 相對小眾的 Python 網站框架 ==
 * TurboGears
 * web.py

== 有名的一行文 Python Web Server ==
 * ``python2 -m SimpleHTTPServer``
 * ``python3 -m http.server``

== 別忘了學會問問題、找答案 ==
見 [[Python/請教問題或FAQ的地方]]

== 熱血的教學文 ==
 * [[http://drweb.nksh.tp.edu.tw/student/lessons/C/|Django 教學網頁(含教學影片)]] by 高慧君 2017.1 (目前完成的部份,是從第7堂課開始)
 * [[http://dokelung-blog.logdown.com/posts/235592-django-notes-table-of-contents|Django筆記 - 目錄 « dokelung's Blog]] 2014.10
 * [[http://www.slideshare.net/lemonlatte/web-develop-in-flask|Web develop in flask]] by Jim Yeh, 2014.10

== 參考資料 ==
 * [[http://tech.mozilla.com.tw/posts/2390/想學-pythondjango-就從-mozilla-網站專案開始吧!|想學 Python/Django? 就從 Mozilla 網站專案開始吧! - Mozilla Tech - 謀智台客]]
 * [[http://wiki.python.org/moin/WebFrameworks|Web Frameworks for Python]] Python 官網 http://wiki.python.org 上的參考資料。
 * [[http://learnpythonthehardway.org/book/|"Learn Python The Hard Way" by Zed A. Shaw]] 的 execise 50、51 及 52 教你如何加入寫網站應用程式(Web Application)的世界
 * 關於網站框架的熱門度參考:
  * [[http://www.quora.com/Python-Web-Frameworks/What-is-the-ratio-of-projects-using-Django-compared-to-other-Python-frameworks-Pylons-Pyramid-Flask-Tornado-etc-Is-where-statistic-about-percentage-of-Django-based-projects|Python Web Frameworks: What is the ratio of projects using Django compared to other Python frameworks (Pylons/Pyramid/Flask/Tornado/etc.). Is where statistic about percentage of Django based projects? - Quora]],2011.12
  * [[http://www.bryceboe.com/2011/02/21/using-stackoverflows-api-to-find-the-top-web-frameworks/|Using StackOverflow’s API to Find the Top Web Frameworks]] by Bryce Boe,2011.02

 * [[http://ruslanspivak.com/lsbaws-part1/|Let’s Build A Web Server. Part 1. - Ruslan's Blog]] 畫的圖很有趣明白。2015.03.09
 * [[http://pyrseas.wordpress.com/2011/12/29/python-web-frameworks-development-server/|Python Web Frameworks - Development Server]] on Taming Serpents and Pachyderms,2011.12.29
  . "Lesson for prospective framework creators: Don't write your own server. However, you may want to enhance your server with auto-reloading, threading, debugging. etc."

== 進階文章 ==
 * [[www.chicagodjango.com/blog/sewing-success-fabric/|Sewing Success with Fabric]] by Dustin Lacewell,2011.12.28
  . "a quick practical example of how Fabric, can make your development life easier."

== 禁(?)技 ==
僅供參考:

[[Thinker]] 的[[http://pastebin.com/yzy0TjRn|手刻四行 hello world]]:

{{{#!python import BaseHTTPServer class handler(BaseHTTPServer.BaseHTTPRequestHandler): pass handler.do_GET = lambda x: x.wfile.write('Hello world') BaseHTTPServer.HTTPServer(('', 8000), handler).serve_forever()
行號 11: 行號 65:

註:行數通常不是選擇 Web Framework 的條件;但少行勝多行是很棒的一點
註:行數通常不是選擇 Web Framework 的條件;但少行勝多行是很棒。

如何開始寫網站應用程式(Web Application)

如果你是 Python 初學者,可先參考 Python/第一次用就上手

如果你是網站開發(Web Development)初學者,可參考 Wikipedia 上的分類:網頁技術分類:網站開發,或用關鍵字「HTML CSS Javascript」搜尋相關資料;當然,這只是網站開發的冰山一角。

通常你可以針對自身的需求、佈署環境、工作環境與團隊來比較各個網站框架(Web Framework),挑一個適合你的選擇。就算真的沒有符合你需求的,自己動手寫一個也不會太難。這也許是人說:「Python 的 Web Framework 比它的關鍵字還多。」的原因。

如果你只是想試一試,沒有什麼需求可言,那就隨便挑一個順眼的。

沒有廢話直接開始

Django Girls 教學手冊 - Django Girls Taipei

有名的 Python 網站框架

  • Django 目前為最大宗。

  • Flask(應該是 Pyhton Web Framework 在 Github 上 star 最多的,也就是說,人氣很旺)
  • Pyramid (Pylons Project)(如果你才剛學 Python,不要用!)

  • web2py
  • bottle.py
  • Zope & Plone(要架 CMS 可以考慮 Plone)

相對小眾的 Python 網站框架

有名的一行文 Python Web Server

  • python2 -m SimpleHTTPServer

  • python3 -m http.server

別忘了學會問問題、找答案

Python/請教問題或FAQ的地方

熱血的教學文

參考資料

進階文章

  • Sewing Success with Fabric by Dustin Lacewell,2011.12.28

    • "a quick practical example of how Fabric, can make your development life easier."

禁(?)技

僅供參考:

Thinker手刻四行 hello world:

   1 

註:行數通常不是選擇 Web Framework 的條件;但少行勝多行還是很棒。

Python/第一次寫Web就上手 (上次是 58-115-33-84 在 2023-01-08 22:40:20 編輯的)