日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Python實現(xiàn)WEB實際測試方法介紹

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

創(chuàng)新互聯(lián)主要從事成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)清流,10多年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18980820575

Python實現(xiàn)WEB測試環(huán)境:

服務(wù)器配置: 4 x Intel(R) Xeon(R) CPU E5405 @ 2.00GHz, 4G內(nèi)存, 操作系統(tǒng): CentOS 5.3 x86_64

nginx前端 + 4 tornado(0.2) web process

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

Python實現(xiàn)WEB測試場景:

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

Python實現(xiàn)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實現(xiàn)WEB的相關(guān)測試方法。


文章標題:Python實現(xiàn)WEB實際測試方法介紹
網(wǎng)頁地址:http://www.dlmjj.cn/article/cdsppop.html