找不到Python应用程序[digitalocean,ubuntu 1604,uWSGI,Nginx]

时间:2018-06-02 20:37:15

标签: ubuntu nginx ubuntu-16.04 uwsgi digital-ocean

在我看的任何地方似乎无法找到帮助。我是第一次尝试在digitalocean上推出一个烧瓶应用程序,但仍然遇到“找不到应用程序”的问题。错误,似乎无法弄清楚为什么它无法检测到我的应用...

uWSGI:

[Unit]
Description=uWSGI items rest

[Service]
Environment=DATABASE_URL=mysql://johndoe:pw@localhost:3306/johndoe
ExecStart=/var/www/html/dir/venv/bin/uwsgi --master --emperor /var/www/html/dir/uwsgi.ini --die-on-term --uid johndoe --gid johndoe --logto /var/www/html/dir/log/emperor.log
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target

uWSGI config:

[uwsgi]
base = /var/www/html/dir
app = run
module = %(app)

home = %(base)/venv
pythonpath = %(base)

socket = %(base)/socket.sock

chmod-socket = 777

processes = 8

threads = 8

harakiri = 15

callable = app

logto = /var/www/html/dir/log/%n.log

Nginx配置:

server {
listen 80;
real_ip_header X-Forwarded-For;
set_real_ip_from 127.0.0.1;
server_name localhost;

location / {
include uwsgi_params;
uwsgi_pass unix:/var/www/html/dir/socket.sock;
uwsgi_modifier1 30;
}
}

run.py:

from app import app
from db import db
db.init_app(app)

@app.before_first_request
def create_tables():
    db.create_all()

app.py:

(condensed to just show appp and database)
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get('DATABASE_URL')
uwsgi错误日志中的

错误消息:

--- no python application found, check your startup logs for errors ---
[pid: 6797|app: -1|req: -1/2] ip () {44 vars in 724 bytes} 
[Sat Jun  2 20:21:30 2018] GET /favicon.ico => generated 21 bytes in .    0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0)
announcing my loyalty to the Emperor...

0 个答案:

没有答案