code
:
# coding: utf-8
import logging
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
logging.info("here is index")
return "<span style='color:red'>I am app 1</span>"
def main():
app.run('*', '8080')
if __name__ == '__main__':
main()
Development Server
$ python3 main.py
$ curl localhost:8080
<span style='color:red'>I am app 1</span>%
uWsgi
uwsgi.ini
:
[uwsgi]
socket = 127.0.0.1:9090
wsgi-file = main.py
callable = app
processes = 4
threads = 2
stats = 127.0.0.1:9191
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.PHP to the list if you are using PHP
index index.html index.htm index.Nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
uwsgi_pass 127.0.0.1:9090;
include uwsgi_params;
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.PHP$ {
# include snippets/fastcgi-PHP.conf;
#
# # With PHP-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/PHP/PHP7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with Nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
$ curl localhost
<span style='color:red'>I am app 1</span>%
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。