flask deployment environment has always been able to run well before. This time, the
Python version of the basic image was upgraded from the original
3.8 , and the title was wrong.
flaskdeployment can refer to this article
Let’s take a look at the start log of docker:
Starting nginx: nginx., *** Starting uWSGI 2.0.18-debian (64bit) on [Tue Aug 17 02:21:46 2021] ***, [uWSGI] getting INI configuration from uwsgi.ini, compiled with version: 8.2.0 on 10 February 2019 02:42:46, os: Linux-3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018, nodename: 9c8cc3ffd4ed, machine: x86_64, pcre jit disabled, detected number of CPU cores: 2, clock source: unix, current working directory: /code, detected binary path: /usr/bin/uwsgi-core, uWSGI running as root, you can use --uid/--gid/--chroot options, chdir() to /code, *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** , *** WARNING: you are running uWSGI without its master process manager ***, your memory page size is 4096 bytes, detected max file descriptor number: 1048576, lock engine: pthread robust mutexes, thunder lock: disabled (you can enable it with --thunder-lock), uwsgi socket 0 bound to TCP address :5000 fd 3, uWSGI running as root, you can use --uid/--gid/--chroot options, *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** , Python version: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0], Python main interpreter initialized at 0x55fa4f5a8990, uWSGI running as root, you can use --uid/--gid/--chroot options, *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** , python threads support enabled, your server socket listen backlog is limited to 100 connections, your mercy for graceful operations on workers is 60 seconds, mapped 825016 bytes (805 KB) for 8 cores, *** Operational MODE: preforking+threaded ***, Traceback (most recent call last):, File "run.py", line 20, in <module>, from server import create_app, File "./server/__init__.py", line 14, in <module>, from flask import Flask, unable to load app 0 (mountpoint='') (callable not found or import error), *** no app loaded. going in full dynamic mode ***, uWSGI running as root, you can use --uid/--gid/--chroot options, *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** , *** uWSGI is running in multiple interpreter mode ***, spawned uWSGI worker 1 (pid: 21, cores: 2), spawned uWSGI worker 2 (pid: 22, cores: 2), spawned uWSGI worker 3 (pid: 23, cores: 2), spawned uWSGI worker 4 (pid: 24, cores: 2)
It can be seen from this that an error is reported when quoting
What causes this problem?
If the program does not find the python Library (flash) when running, it will report an error.
Here, we don’t care why he didn’t find it. Since he didn’t find it, we’ll take the initiative to tell him where to find it.
uwsgi. Ini , and set the value of
Python path to
/usr/local/lib/Python 3.8/site packages/.
The content of the modified
uwsgi. Ini file is:
[uwsgi] chdir = /code socket = :5000 pythonpath = /usr/local/lib/python3.8/site-packages/ wsgi-file = run.py callable = app chmod-socket = 666 plugins = python3 buffer-size = 65535 processes = 4 threads = 2
All right, problem solved.
- flask init-db Error: Error: Could not locate a Flask application. Use the ‘flask –app’ option, ‘FLASK_APP’ environment variable, or a ‘wsgi.py’ or ‘app.py’ file in the current directory.
- [Solved] No module named ‘pywt‘ or ModuleNotFoundError: No module named ‘skimage.metrics‘
- [Solved] Win10 Warning: ModuleNotFoundError: No module named ‘win32con‘ and No module named ‘antlr4‘
- How to Solve ModuleNotFoundError: No module named ‘_bz2‘
- [Solved] Tensorflow-gpu 2.0.0 Run Error: ModuleNotFoundError: No module named ‘tensorflow_core.estimator‘
- Flask Startup Error: s.bind(server_address)PermissionError: [Errno 13] Permission denied
- ImportError: No module named google.protobuf.internal
- The solution of no module named ‘jinja2. Asyncsupport’
- Centos pip install uwsgi error: “fatal error: Python.h: No such file or directory”
- [Solved] Docker Error: got permission denied while trying to connect to the docker daemon socket at…
- [Solved] There is no getter for property named ‘distinct’ in…
- JMeter JDBC Error: No pool found named: ‘test‘ [How to Solve]
- [Solved] docker Error: bridge docker0 failed: exchange full
- [Solved] CentOS build a docker error: job for docker.service failed….
- [Solved] SpringBoot Project Start Error: No bean named ‘org.springframework.context.xxxxx.importRegistry‘ available
- How to Fix ERROR Couldn’t connect to Docker daemon at http+docker://localunixsocket
- Error: Unable to build IHost No DbContext named ‘PersistedGrantDbContext‘ was found.
- Docker Open Error: Warning: docker.service changed on disk. Run ‘systemctl daemon-reload‘ to reload unit
- Docker Create tomcat Error standard_init_linux.go:211: exec user process caused “no such file or directory”
- [Solved] swiper Error: The requested module ‘react’ is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export