python web py入门(1)-web.py简介和安装

 1.web.py 简介
web.py是一个轻量级的python web框架,简单而且功能强大。相对flask和Django,web.py更适合初学者来学习和了解web开发的基础知识。


2.web.py的安装
不用说,前提条件是安装了python环境。官方网站:http://webpy.org/, 可以看看文档,介绍如何安装,和入门教程等资料。


3. Windows下安装环境
python 3.6
从网站:https://github.com/9073204qq/webpy 下载源码


pip install db
pip install utils


到下载源码的目录:
python setup.py install

运行这个命令行,会输出如下:

D:\AI\python\web\webpy>python setup.py install
C:\Users\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\dist.py:355: UserWarning: Normalizing '0.40-dev0' to '0.40.dev0'
  normalized_version,
running install
running bdist_egg
running egg_info
writing web.py.egg-info\PKG-INFO
writing dependency_links to web.py.egg-info\dependency_links.txt
writing top-level names to web.py.egg-info\top_level.txt
reading manifest file 'web.py.egg-info\SOURCES.txt'
writing manifest file 'web.py.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying web\wsgiserver\wsgiserver2.py -> build\lib\web\wsgiserver
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\web
copying build\lib\web\application.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\browser.py -> build\bdist.win-amd64\egg\web
creating build\bdist.win-amd64\egg\web\contrib
copying build\lib\web\contrib\template.py -> build\bdist.win-amd64\egg\web\contrib
copying build\lib\web\contrib\__init__.py -> build\bdist.win-amd64\egg\web\contrib
copying build\lib\web\db.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\debugerror.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\form.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\http.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\httpserver.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\net.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\py3helpers.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\session.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\template.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\test.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\utils.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\webapi.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\webopenid.py -> build\bdist.win-amd64\egg\web
copying build\lib\web\wsgi.py -> build\bdist.win-amd64\egg\web
creating build\bdist.win-amd64\egg\web\wsgiserver
copying build\lib\web\wsgiserver\ssl_builtin.py -> build\bdist.win-amd64\egg\web\wsgiserver
copying build\lib\web\wsgiserver\ssl_pyopenssl.py -> build\bdist.win-amd64\egg\web\wsgiserver
copying build\lib\web\wsgiserver\wsgiserver2.py -> build\bdist.win-amd64\egg\web\wsgiserver
copying build\lib\web\wsgiserver\wsgiserver3.py -> build\bdist.win-amd64\egg\web\wsgiserver
copying build\lib\web\wsgiserver\__init__.py -> build\bdist.win-amd64\egg\web\wsgiserver
copying build\lib\web\__init__.py -> build\bdist.win-amd64\egg\web
byte-compiling build\bdist.win-amd64\egg\web\application.py to application.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\browser.py to browser.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\contrib\template.py to template.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\contrib\__init__.py to __init__.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\db.py to db.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\debugerror.py to debugerror.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\form.py to form.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\http.py to http.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\httpserver.py to httpserver.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\net.py to net.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\py3helpers.py to py3helpers.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\session.py to session.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\template.py to template.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\test.py to test.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\utils.py to utils.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\webapi.py to webapi.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\webopenid.py to webopenid.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\wsgi.py to wsgi.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\wsgiserver\ssl_builtin.py to ssl_builtin.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\wsgiserver\ssl_pyopenssl.py to ssl_pyopenssl.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\wsgiserver\wsgiserver2.py to wsgiserver2.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\wsgiserver\wsgiserver3.py to wsgiserver3.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\wsgiserver\__init__.py to __init__.cpython-36.pyc
byte-compiling build\bdist.win-amd64\egg\web\__init__.py to __init__.cpython-36.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying web.py.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying web.py.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying web.py.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying web.py.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
web.__pycache__.application.cpython-36: module references __file__
web.__pycache__.debugerror.cpython-36: module references __file__
creating 'dist\web.py-0.40.dev0-py3.6.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing web.py-0.40.dev0-py3.6.egg
removing 'c:\users\appdata\local\programs\python\python36\lib\site-packages\web.py-0.40.dev0-py3.6.egg' (and everything under it)
creating c:\users\appdata\local\programs\python\python36\lib\site-packages\web.py-0.40.dev0-py3.6.egg
Extracting web.py-0.40.dev0-py3.6.egg to c:\users\appdata\local\programs\python\python36\lib\site-packages
web.py 0.40.dev0 is already the active version in easy-install.pth


Installed c:\users\appdata\local\programs\python\python36\lib\site-packages\web.py-0.40.dev0-py3.6.egg
Processing dependencies for web.py==0.40.dev0
Finished processing dependencies for web.py==0.40.dev0


4.测试安装是否正常

创建测试代码:

import web

urls = (
    '/(.*)', 'hello'
)

app = web.application(urls, globals())

class hello:
    def GET(self, name):
        if not name:
            name = 'World'
        return 'Hello, ' + name + '!'
    

if __name__ == "__main__":
    app.run()
结果输出如下:

python web py入门(1)-web.py简介和安装_第1张图片

比特币源码入门教程

https://edu.csdn.net/course/detail/6998

深入浅出Matplotlib
https://edu.csdn.net/course/detail/6859

深入浅出Numpy
http://edu.csdn.net/course/detail/6149 

Python游戏开发入门

http://edu.csdn.net/course/detail/5690

你也能动手修改C编译器

http://edu.csdn.net/course/detail/5582

纸牌游戏开发

http://edu.csdn.net/course/detail/5538 

五子棋游戏开发

http://edu.csdn.net/course/detail/5487
RPG游戏从入门到精通
http://edu.csdn.net/course/detail/5246




你可能感兴趣的:(milang(小语),webpy)