I have a server of Tencent Cloud. I use flask,uwsgi,nginx to build a server.
is written like this according to the method on the Internet.
my nginx configuration is
I modified this file / etc/nginx/sites-enabled/default
server {
listen 80;
server_name 111.230.140.182;
charset utf-8;
client_max_body_size 75M;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8080;
uwsgi_param UWSGI_PYTHON /usr/bin/python;
uwsgi_param UWSGI_CHDIR /home/ubuntu/project/test;
uwsgi_param UWSGI_SCRIPT test:app ;
}
}
then my uwsgi.ini configuration is written like this:
[uwsgi]
socket = 127.0.0.1:8080
plugins = python
chidir = /home/ubuntu/project/test
wsgi-file = /home/ubuntu/project/test/test.py
callable = app -sharp
protocol=http
module=test
processes = 4
threads = 2
then my test.py is written like this:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "<h1> hello world! </h1>"
if __name__ =="__main__":
app.run(debug=True)
I first run nginx, and then run uwsgi, but I report this error:
mapped 332288 bytes (324 KB) for 8 cores
Operational MODE: preforking+threaded
unable to load app 0 (mountpoint="") (callable not found or import error)
unable to find "application" callable in file / home/ubuntu/project/test/test.py
unable to load app 0 (mountpoint="") (callable not found or import error)
I also checked a lot of articles that didn"t solve my problem. Come here for advice!
Thank you!