Flask+Nginx+uWSGI : ImportError: No module named site
I installed as the http://www.reinbach.com/uwsgi-nginx-flask-virtualenv-mac-os-x.html link's tutorial and when executing the command
uwsgi --ini deploy/deploy.ini, the terminal says there was an import error:
ImportError: No module named site
I have set my
export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages export PYTHONHOME=$PYTHONHOME:/Library/Python/2.7
I cannot figure out what wrong with it.
Could someone help me with the problem?
The whole info in the terminal is shown as below if it is helpful:
(env)ios-devmatoMacBook-Pro:hello ios_dev$ uwsgi --ini deploy/deploy.ini [uWSGI] getting INI configuration from deploy/deploy.ini *** Starting uWSGI 1.9.10 (64bit) on [Fri May 17 16:42:22 2013] *** compiled with version: 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) on 17 May 2013 12:41:07 os: Darwin-11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu- 1699.32.7~1/RELEASE_X86_64 nodename: ios-devmatoMacBook-Pro.local machine: x86_64 clock source: unix detected number of CPU cores: 4 current working directory: /Users/ios_dev/Desktop/sample/hello detected binary path: /Users/ios_dev/Documents/little/little-web/little_web_dev/env/bin/uwsgi your processes number limit is 709 your memory page size is 4096 bytes detected max file descriptor number: 256 lock engine: OSX spinlocks uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3 Python version: 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
ImportError: No module named site
Here's how I resolved the same error message
(ImportError: No module named site) that I got while trying the Django and NGINX tutorial — uWSGI 2.0 documentation.
Deactivate the virtualenv:
Install uWSGI system-wide (if not already installed system-wide)
sudo pip install uwsgi
uwsgi.ini file. I commented out the line with the:
home = /path/to/virtualenv
uWSGI --ini mysite_uwsgi.ini.
Nginx & uWSGI: ImportError: No module named site, The reason why it wasn't working is because I installed uwsgi using the regular pip command. Since I have both Python 2 & 3 in the machine, Flask+Nginx+uWSGI : ImportError: No module named site. Ask Question Asked 6 years, 11 months ago. Active 6 months ago. (ImportError: No module named site)
I read a lot of document about the question, but get no answer.
By coincidentally, I fix this problem by edit uid and gid as root.
It seem like a permissions problem. I don't know why, but it just work. Remember, it is very unsafe to run a product environment as root.
ImportError: No module named flask · Issue #169 · tiangolo/uwsgi , ImportError: No module named flask #169 i have created an app using this code [https://github.com/tiangolo/uwsgi-nginx-flask-docker/tree/ Traceback (most recent call last): File "myflaskapp.py", line 1, in <module> from flask import Flask ImportError: No module named flask unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode *** and I don't understand why. I have flask installed (pip install flask).
1、active the virtual you used
2、 pip install uwsgi
this the key action，then the
command -v wsgi
3、use current user to run
uwsgi, because other user is not active the virtualenv
python uwsgi + Flask + virtualenv ImportError: no module named site , The "no module named " import error generally means that uwsgi doesn't have the correct path to the virtualenv. The no-site flag will stop the virtualenv from $ uwsgi --http-socket :9090 --plugin python --wsgi-file app.py *** Starting uWSGI 126.96.36.199-debian (64bit) on [Fri Mar 25 02:56:14 2016] *** compiled with version: 4.8.2 on 23 March 2014 17:15:32 os: Linux-3.13.0-79-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 nodename: flask machine: x86_64 clock source: unix pcre jit disabled detected
Im My case I wasn't using virtualEnv. Just using django + ngnix. My solution was removing HOME variable into the *.ini configuration file:
sudo nano /etc/uwsgi/sites/c_app.ini
[uwsgi] project = c_app uid = ubuntu base = /home/%(uid) chdir = %(base)/%(project) **home = %(base)/%(project)** (REMOVED IT) module = %(project).wsgi:application master = true processes = 5 socket = /run/uwsgi/%(project).sock chown-socket = %(uid):www-data chmod-socket = 660 vacuum = true
then it works.
Flask program giving module not found, Im building a python web application with flask and uWSGI following this /how-to-serve-flask-applications-with-uwsgi-and-nginx-on-centos-7 and it the basic hello does indeed appear in the website hen loaded. app/__init__.py", line 2, in <module> import pylab as pl ImportError: No module named Leave a comment. Add comments here to get more clarity or context around a question. To answer a question, use the “Answer” field below.
ImportError with Flask, 3.5 venv File '/var/www/html/site-available/src/app.py', line 1, in from flask import Flask, render_template ImportError: No module named flask ImportError: No module named app unable to load app 0 (mountpoint='') (callable not found or import error) Traceback (most recent call last): File "./fab-skeleton/run.py", line 1, in from app import app ImportError: No module named app unable to load app 0 (mountpoint='') (callable not found or import error)
16.04, ImportError: No module named os I try to host my webpage in a server with OS Ubuntu 16.04 and Python2/Flask/uwsgi(emperor). The configuration of The nginx configuration file /etc/nginx/sites-enabled/proxy : upstream All Nginx needs to worry about is pointing to this socket for incoming traffic. Now we can run our app with the proper configuration efficiently: $ uwsgi myapp.ini. That's much better. As an added bonus, the presence of die-on-term = true in our config means that our uWSGI process will end when we Control+C, for convenience's sake. uWSGI
Deploy Flask Applications with uWSGI and Nginx, Set up uWSGI to serve your app concurrently while handling incoming traffic with Nginx. flask import Flask ModuleNotFoundError: No module named 'flask' unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in sudo vim /etc/nginx/sites-available/myapp.conf richard-to changed the title uWSGI - `ImportError: No module named google.oauth2.credentials` uWSGI - ImportError: No module named google.oauth2.credentials Mar 29, 2018 This comment has been minimized.