1. webpy debug

最後更新: 2021-09-27

目錄

  • Debug Mode
  • Auto Reload Source Code
  • 在 console output msg
  • Comment block

 


Debug Mode

 

webpy 的 built-in webserver 是在 debug mode 的,

在此 mode 上, console 上有詳細的 log

The debug is not enabled when the application is run in a real webserver.

Disable debug:

web.config.debug = False

 


Auto Reload Source Code

 

Apache

# Normally this would be set to a value of '0',

# indicating that the process should never be restarted as a result of the number of requests processed.

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  1
</IfModule>

<IfModule worker.c>
StartServers         4
MaxClients         300
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  1
</IfModule>

 


在 console output msg

 

web.debug("I will get printed to the console and not the body of the webpage")

在 "web.config.debug = False" 都用到

 


Comment block

 

#'''
print "Multiline comment block"
#'''
print "Multiline comment block"
#'''

######################################

#'''
print "Block 1"
'''
print "Block 2"
#'''

######################################

'''
print "Block 1"
'''
print "Block 2"
#'''

 

 

Creative Commons license icon Creative Commons license icon