Python Forum
ImportError: No module named site
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ImportError: No module named site
#1
I'm trying to do this tutorial:

https://docs.djangoproject.com/en/3.0/ho...sgi/uwsgi/

(I've read other site's and docs for like 3 days and I still can't get uwsgi to work, let along get nginx to start talking to it; either the docs are terrible or I'm an idiot.)

I have everything set up as specified here:

https://docs.djangoproject.com/en/3.0/intro/tutorial01/

So no matter what I try I get "ImportError: No module named site". I googled around for that and none of the suggested solutions are relevant. Here's how I'm starting uwsgi:

 sudo uwsgi --chdir=/home/bog/django-apps/dailydiscountdj/dailydiscountdj     --module=dailydiscountdj.wsgi:application     --env DJANGO_SETTINGS_MODULE=dailydiscountdj.settings     --master --pidfile=/tmp/project-master.pid     --socket=127.0.0.1:49152     --processes=5    --uid=1000 --gid=2000     --harakiri=20     --max-requests=5000     --vacuum     --home=/home/bog/django-apps/env  
And same thing above the first argument is different; I tried shortening the path:
--chdir=/home/bog/django-apps/dailydiscountdj



This is the output I get:
*** Starting uWSGI 2.0.18 (64bit) on [Thu Feb  6 11:38:03 2020] ***
compiled with version: 7.4.0 on 15 May 2019 18:53:37
os: Linux-4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020
nodename: bog-Lenovo-Product
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /home/bog/django-apps/dailydiscountdj
writing pidfile to /tmp/project-master.pid
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
setgid() to 2000
set additional group 4 (adm)
set additional group 7 (lp)
set additional group 24 (cdrom)
set additional group 27 (sudo)
set additional group 30 (dip)
set additional group 46 (plugdev)
set additional group 116 (lpadmin)
set additional group 118 (scanner)
set additional group 126 (sambashare)
setuid() to 1000
chdir() to /home/bog/django-apps/dailydiscountdj/dailydiscountdj
your processes number limit is 63332
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers *** 
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:49152 fd 3
Python version: 2.7.17 (default, Nov  7 2019, 10:07:09)  [GCC 7.4.0]
Set PythonHome to /home/bog/django-apps/env
ImportError: No module named site
And yes, I'm running this in a virtualenv called env; hence the path.

Thanks
Reply
#2
Perhaps try to run
Output:
env | grep PY
to see if you have any bad python-related environment variable.
Reply
#3
(Feb-06-2020, 08:32 PM)Gribouillis Wrote: Perhaps try to run
Output:
env | grep PY
to see if you have any bad python-related environment variable.

Yea I tried that actually, nope, nothing.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  "ImportError: No module named _ssl" click1234 3 9,474 Oct-05-2017, 06:04 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020