This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
язык_программирования_python [2025/01/23 12:36] val [Web приложение] |
язык_программирования_python [2025/03/16 11:44] (current) val [Web приложение] |
||
---|---|---|---|
Line 52: | Line 52: | ||
config = configparser.ConfigParser() | config = configparser.ConfigParser() | ||
config.read('/etc/pywebd/pywebd.conf') | config.read('/etc/pywebd/pywebd.conf') | ||
- | pywebd_port = os.environ.get('PYWEBD_PORT',config['default']['Listen']) | + | # pywebd_port = os.environ.get('PYWEBD_PORT',config['default']['Listen']) |
- | pywebd_doc_root = os.environ.get('PYWEBD_DOC_ROOT',config['default']['DocumentRoot']) | + | # pywebd_doc_root = os.environ.get('PYWEBD_DOC_ROOT',config['default']['DocumentRoot']) |
+ | if 'PYWEBD_PORT' in os.environ: | ||
+ | pywebd_port = os.environ.get('PYWEBD_PORT') | ||
+ | else: | ||
+ | pywebd_port = config['default']['Listen'] | ||
+ | if 'PYWEBD_DOC_ROOT' in os.environ: | ||
+ | pywebd_doc_root = os.environ.get('PYWEBD_DOC_ROOT') | ||
+ | else: | ||
+ | pywebd_doc_root = config['default']['DocumentRoot'] | ||
app.run(host="0.0.0.0", port=pywebd_port, debug=True) | app.run(host="0.0.0.0", port=pywebd_port, debug=True) | ||
# app.run(ssl_context=('/etc/pywebd/pywebd.crt', '/etc/pywebd/pywebd.key'), debug=True, host='0.0.0.0', port=pywebd_port) | # app.run(ssl_context=('/etc/pywebd/pywebd.crt', '/etc/pywebd/pywebd.key'), debug=True, host='0.0.0.0', port=pywebd_port) | ||
+ | |||
</code><code> | </code><code> | ||
# mkdir -p /etc/pywebd/ | # mkdir -p /etc/pywebd/ | ||
Line 65: | Line 75: | ||
Listen = 4080 | Listen = 4080 | ||
</code><code> | </code><code> | ||
- | # ### cp /root/wild.crt /etc/pywebd/pywebd.crt | + | # #cp /root/wild.crt /etc/pywebd/pywebd.crt |
- | + | # #cp /root/wild.key /etc/pywebd/pywebd.key | |
- | # ### cp /root/wild.key /etc/pywebd/pywebd.key | + | |
</code> | </code> | ||
Line 75: | Line 84: | ||
(venv1) :~/pywebd$ #export PYWEBD_PORT=4443 | (venv1) :~/pywebd$ #export PYWEBD_PORT=4443 | ||
(venv1) :~/pywebd$ #export PYWEBD_DOC_ROOT=/var/www/html/ | (venv1) :~/pywebd$ #export PYWEBD_DOC_ROOT=/var/www/html/ | ||
+ | (venv1) :~/pywebd$ #PYWEBD_PORT=4443 PYWEBD_DOC_ROOT=/var/www/html/ python app.py | ||
(venv1) :~/pywebd$ python app.py | (venv1) :~/pywebd$ python app.py |