uWSGI + virtualenv 'No module named site'

前端 未结 3 1180
一个人的身影
一个人的身影 2021-02-13 12:04

So this seems to be a really common problem with this setup, but I can\'t find any solutions that work on SO. I\'ve setup a very new Ubuntu 15.04 server, then installed nginx, v

3条回答
  •  离开以前
    2021-02-13 12:45

    In my case, I was seeing this issue because the django app I was trying to run was written in python 3 whereas uwsgi was configured for python 2. I fixed the problem by:

    1. recompiling uwsgi to support both python 2 and python 3 apps (I followed this guide)
    2. adding this to my mydjangoproject_uwsgi.ini:
    plugins         = python35 # or whatever you specified while compiling uwsgi 
    

    For other folks using Django, you should also make sure you are correctly specifying the following:

    # Django dir that contains manage.py
    chdir           = /var/www/project/myprojectname
    # Django wsgi (myprojectname is the name of your top-level project)
    module          = myprojectname.wsgi:application
    # the virtualenv you are using (full path)
    home            = /home/ubuntu/Env/mydjangovenv
    plugins         = python35
    

提交回复
热议问题