成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Python實現WEB實際測試方法介紹

開發 后端
Python實現WEB在實際應用中是一個比較常見的應用技巧。我們在這篇文章中主要是通過對其的測試方法進行了詳細的介紹。

其實,我們可以使用純Python語言來實現WEB,那么在實現之后還是需要對這一功能進行相關測試。在這里我們就會通過一定的方法來進行Python實現WEB的測試,希望大家可以以此為學習參考對象。#t#

Python實現WEB測試環境:

服務器配置: 4 x Intel(R) Xeon(R) CPU E5405 @ 2.00GHz, 4G內存, 操作系統: CentOS 5.3 x86_64

nginx前端 + 4 tornado(0.2) web process

tornado: http://www.tornadoweb.org (已被墻)

Python實現WEB測試場景:

http get請求,服務器端直接返回"hello world"

Python實現WEB代碼及nginx配置:

  1. main.py:  
  2. #!/usr/bin/python  
  3. # -*- coding: utf-8 -*-  
  4. """web main"""  
  5. from tornado.httpserver import HTTPServer  
  6. from tornado.ioloop import IOLoop  
  7. from tornado.web import RequestHandler, Application, authenticated  
  8. #from rockps.auth import AuthHandler  
  9. class MainHandler(RequestHandler):  
  10. def get(self):  
  11. self.write("hello world")  
  12. settings = {  
  13. }  
  14. application = Application([  
  15. (r"/", MainHandler),  
  16. ], **settings)  
  17. if __name__ == "__main__":  
  18. http_server = HTTPServer(application)  
  19. http_server.listen(8081)  
  20. IOLoop.instance().start()  
  21. nginx.conf:  
  22. user root;  
  23. worker_processes 1;  
  24. error_log /var/nginx_error.log;  
  25. pid /var/run/nginx.pid;  
  26. events {  
  27. worker_connections 51200;  
  28. use epoll;  
  29. }  
  30. http {  
  31. # Enumerate all the Tornado servers here  
  32. upstream frontends {  
  33. server 127.0.0.1:8081;  
  34. server 127.0.0.1:8082;  
  35. server 127.0.0.1:8083;  
  36. server 127.0.0.1:8084;  
  37. }  
  38. #include /etc/nginx/mime.types;  
  39. default_type application/octet-stream;  
  40. access_log /var/log/nginx/access22.log;  
  41. keepalive_timeout 65;  
  42. proxy_read_timeout 200;  
  43. sendfile on;  
  44. tcp_nopush on;  
  45. tcp_nodelay on;  
  46. gzip on;  
  47. gzip_min_length 1000;  
  48. gzip_proxied any;   
  49. gzip_types text/plain text/html text/css text/xml  
  50. application/x-javascript application/xml  
  51. application/atom+xml text/javascript;  
  52. # Only retry if there was a communication error, not a timeout  
  53. # on the Tornado server (to avoid propagating "queries of death"  
  54. # to all frontends)  
  55. proxy_next_upstream error;  
  56. server {  
  57. listen 8085;  
  58. # Allow file uploads  
  59. client_max_body_size 50M;  
  60. location ^~ /static/ {  
  61. root /var/www;  
  62. if ($query_string) {  
  63. expires max;  
  64. }  
  65. }  
  66. location = /favicon.ico {  
  67. rewrite (.*) /static/favicon.ico;  
  68. }  
  69. location = /robots.txt {  
  70. rewrite (.*) /static/robots.txt;  
  71. }  
  72. location / {  
  73. proxy_pass_header Server;  
  74. proxy_set_header Host $http_host;  
  75. proxy_set_header X-Real-IP $remote_addr;  
  76. proxy_set_header X-Scheme $scheme;  
  77. proxy_pass http://frontends;  
  78. }  
  79. }  

以上就是對Python實現WEB的相關測試方法。

責任編輯:曹凱 來源: 博客園
相關推薦

2009-12-30 15:53:28

Silverlight

2017-07-18 15:13:17

2010-03-04 11:12:02

Python AOP

2010-01-07 18:17:00

VB.NET連接SAP

2020-11-30 10:15:00

Python突變測試編程語言

2010-03-25 09:38:03

Eclipse開發Py

2010-03-09 14:23:37

Python列表內涵

2010-02-06 18:04:21

Android 接口

2011-07-04 17:53:48

快速測試

2010-01-04 16:50:04

Silverlight

2010-01-07 10:46:27

VB.NET Sock

2010-03-16 09:20:25

Python時間

2010-03-05 13:48:24

Python for

2010-03-19 14:59:00

python Stri

2010-02-03 16:35:45

C++回文

2010-01-26 17:36:17

Android實現全屏

2009-12-28 11:14:29

WPF顯示文本

2010-03-17 15:58:08

Python環境

2010-03-22 09:54:38

Python開發環境

2010-03-23 18:20:26

Python os.g
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 成人免费观看男女羞羞视频 | av中文天堂 | 日本视频中文字幕 | 99久久亚洲 | 久久综合狠狠综合久久综合88 | 中文字幕第一页在线 | 男人电影天堂 | 福利二区| 精品欧美一区二区三区久久久 | 午夜免费影视 | 99久久精品免费看国产高清 | 亚洲视频免费在线观看 | 亚洲免费视频在线观看 | 国产精品久久久久久久久久免费看 | 久久99视频这里只有精品 | 在线视频h| 麻豆一区| 欧美日韩国产精品激情在线播放 | 国产欧美日韩综合精品一区二区 | 国产一区亚洲二区三区 | 成人一区二 | 亚洲综合在线播放 | 日韩一区二 | 中文字幕在线观看一区 | 精品日韩| 亚洲视频中文 | 国产精品久久久久久久久免费 | 伊人av在线播放 | 九九亚洲 | 在线免费观看欧美 | 色综合天天天天做夜夜夜夜做 | 国产精品久久久久久久免费大片 | 亚洲午夜在线 | 中文字幕第三页 | 夜夜艹天天干 | 欧美美女被c | 日韩在线免费观看视频 | 免费观看成人av | 久久精品一 | 中文字幕亚洲视频 | 久久无毛|