当我尝试使用this tip在Digital Ocean上运行我的应用程序时,出现错误,无法解决。尝试了一切,并寻找不同的解决方案。在我进入第5步的最后
sudo systemctl start Flask_app
我收到:
simfree@SimFree:~$ sudo systemctl status Flask_app
● Flask_app.service - uWSGI instance to serve Flask_app
Loaded: loaded (/etc/systemd/system/Flask_app.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2018-09-15 20:48:17 UTC; 2min 40s ago
Main PID: 24670 (uwsgi)
Tasks: 6 (limit: 4704)
├─24670 /home/simfree/Flask_app/parseenv/bin/uwsgi --ini Flask_app.ini
├─24690 /home/simfree/Flask_app/parseenv/bin/uwsgi --ini Flask_app.ini
├─24691 /home/simfree/Flask_app/parseenv/bin/uwsgi --ini Flask_app.ini
├─24692 /home/simfree/Flask_app/parseenv/bin/uwsgi --ini Flask_app.ini
├─24693 /home/simfree/Flask_app/parseenv/bin/uwsgi --ini Flask_app.ini
└─24694 /home/simfree/Flask_app/parseenv/bin/uwsgi --ini Flask_app.ini
Sep 15 20:48:17 SimFree uwsgi[24670]: sudo apt-get install xvfb
Sep 15 20:48:17 SimFree uwsgi[24670]: unable to load app 0 (mountpoint='') (callable not found or import error)
Sep 15 20:48:17 SimFree uwsgi[24670]: *** no app loaded. going in full dynamic mode ***
Sep 15 20:48:17 SimFree uwsgi[24670]: *** uWSGI is running in multiple interpreter mode ***
Sep 15 20:48:17 SimFree uwsgi[24670]: spawned uWSGI master process (pid: 24670)
Sep 15 20:48:17 SimFree uwsgi[24670]: spawned uWSGI worker 1 (pid: 24690, cores: 1)
Sep 15 20:48:17 SimFree uwsgi[24670]: spawned uWSGI worker 2 (pid: 24691, cores: 1)
Sep 15 20:48:17 SimFree uwsgi[24670]: spawned uWSGI worker 3 (pid: 24692, cores: 1)
Sep 15 20:48:17 SimFree uwsgi[24670]: spawned uWSGI worker 4 (pid: 24693, cores: 1)
Sep 15 20:48:17 SimFree uwsgi[24670]: spawned uWSGI worker 5 (pid: 24694, cores: 1)
这是我的文件夹中的一棵树:
Flask_app
|-main.py
|-wsgi.py
|-Flask_app.ini
在我使用
时有效uwsgi --socket 0.0.0.0:5000 --protocol=http -w wsgi:app
所以这个问题肯定没有与wsgi.py文件链接。
这是我的wsgi.py文件(所需的所有文件):
from main import app
if __name__ == "__main__":
app.run()
这是我的Flask_app.ini文件:
[uwsgi]
module = wsgi:app
master = true
processes = 5
socket = Flask_app.sock
chmod-socket = 660
vacuum = true
die-on-term = true
和Flask_app.service:
[Unit]
Description=uWSGI instance to serve Flask_app
After=network.target
[Service]
User=simfree
Group=www-data
WorkingDirectory=/home/simfree/Flask_app
Environment="PATH=/home/simfree/Flask_app/parseenv/bin"
ExecStart=/home/simfree/Flask_app/parseenv/bin/uwsgi --ini Flask_app.ini
[Install]
WantedBy=multi-user.target
如您所见,我拥有所需的一切。花大量时间寻找解决方案,但没有任何帮助。您知道什么会发生此问题吗?非常感谢。