I
I
Ivan2016-02-11 17:50:22
Django
Ivan, 2016-02-11 17:50:22

ImportError: No module named myproject.wsgi. How to fix?

Good day. I want to raise the project on the server. I am using Gunicorn+Nginx.
Setting up Nginx

server {

        listen 80;
        server_name 'server ip';

        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {

                root /home/user/sites/project;
        }

        location / {

         include proxy_params;
         proxy_pass http://unix:/home/user/sites/project/myproject/myproject.sock;
        }

}

Gunicorn settings:
description "Gunicorn desc"

start on runlevel [2345]
stop on runlevel [!2345]

respawn
setuid usr
setgid www-data
chdir /home/usr/sites/project

exec env/bin/gunicorn --workers 3 --bind unix:/home/usr/sites/project/myproject/myproject.sock myproject.wsgi:application

I did everything according to this guide
I will add wsgi.py settings
import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")

application = get_wsgi_application()

and settings.py
WSGI_APPLICATION = 'myproject.wsgi.application'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-02-11
@dmtrrr

PYTHONPATH

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question