J
J
Jekson2019-06-27 09:46:13
uWSGI
Jekson, 2019-06-27 09:46:13

How to set up uwsgi to work with Django and pipenv?

I'm setting up a server to work with a Django application. Django 2.2 python 3.7. nginx + uwsgi server. The first time I had to install pipenv instead of virtualenv + virtualenvwrapper with its understandable Env folder, one of the questions is whether I correctly determine the path to the virtual environment, since I could not find a clear description of where it is located. I see that along this path it seems to be what you need

home/user/.local/share/virtualenvs/cv-base-OJRyhy6U

Но основной вопрос в другом - на данный момент мой сайт отдает
Internal Server Error
и проблем судя по всему в неправильной конфигурации ini файла.
На данный момент структура проекта такая
cv-base
    ├── Model.mdj
    ├── Pipfile
    ├── Pipfile.lock
    ├── README.md
    └── ems
        ├── base
        │   ├── __init__.py
        │   ├── admin.py
        │   ├── apps.py
        │   ├── migrations
        │   │   ├── 0001_initial.py
        │   │   └── __init__.py
        │   ├── models.py
        │   ├── schema.py
        │   ├── services
        │   │   ├── __init__.py
        │   │   └── exporter.py
        │   ├── tests.py
        │   ├── urls.py
        │   └── views.py
        ├── db.sqlite3
        ├── ems
        │   ├── __init__.py
        │   ├── schema.py
        │   ├── settings.py
        │   ├── urls.py
        │   └── wsgi.py
        ├── manage.py
        ├── static
        ├── templates
        └── users
            ├── __init__.py
            ├── admin.py
            ├── apps.py
            ├── forms.py
            ├── migrations
            │   ├── 0001_initial.py
            │   └── __init__.py
            ├── models.py
            ├── tests.py
            └── views.py

/etc/uwsgi/sites/cv-base.ini содержит
[uwsgi]
project = cv-base
uid = cvc
base = /home/%(uid)
chdir = %(base)/%(project)/ems
home = %(base)/.local/share/virtualenvs/cv-base-OJRyhy6U
module = %(project).wsgi:application
master = true
processes = 5
socket = /run/uwsgi/%(project).sock
chown-socket = %(uid):www-data
chmod-socket = 660
vacuum = true

Вот что отдает sudo systemctl status uwsgi
uwsgi.service - uWSGI Emperor service
   Loaded: loaded (/etc/systemd/system/uwsgi.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-06-27 06:26:36 UTC; 17min ago
  Process: 19518 ExecStartPre=/bin/bash -c mkdir -p /run/uwsgi; chown cvc:www-data /run/uwsgi (code=exited, status=0/SUCCESS)
 Main PID: 19530 (uwsgi)
   Status: "The Emperor is governing 1 vassals"
    Tasks: 7 (limit: 1152)
   CGroup: /system.slice/uwsgi.service
           ├─19530 /usr/local/bin/uwsgi --emperor /etc/uwsgi/sites
           ├─19531 /usr/local/bin/uwsgi --ini cv-base.ini
           ├─19534 /usr/local/bin/uwsgi --ini cv-base.ini
           ├─19535 /usr/local/bin/uwsgi --ini cv-base.ini
           ├─19536 /usr/local/bin/uwsgi --ini cv-base.ini
           ├─19537 /usr/local/bin/uwsgi --ini cv-base.ini
           └─19538 /usr/local/bin/uwsgi --ini cv-base.ini

Jun 27 06:27:02 CV-base uwsgi[19530]: --- no python application found, check your startup logs for errors ---
Jun 27 06:27:02 CV-base uwsgi[19530]: [pid: 19538|app: -1|req: -1/1] 134.17.26.62 () {44 vars in 862 bytes} [Thu Jun 27 06:27:02 2019] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
Jun 27 06:27:02 CV-base uwsgi[19530]: announcing my loyalty to the Emperor...
Jun 27 06:27:02 CV-base uwsgi[19530]: Thu Jun 27 06:27:02 2019 - [emperor] vassal cv-base.ini is now loyal
Jun 27 06:27:33 CV-base uwsgi[19530]: --- no python application found, check your startup logs for errors ---
Jun 27 06:27:33 CV-base uwsgi[19530]: [pid: 19536|app: -1|req: -1/2] 134.17.26.62 () {44 vars in 862 bytes} [Thu Jun 27 06:27:33 2019] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
Jun 27 06:27:33 CV-base uwsgi[19530]: announcing my loyalty to the Emperor...
Jun 27 06:27:33 CV-base uwsgi[19530]: Thu Jun 27 06:27:33 2019 - [emperor] vassal cv-base.ini is now loyal
Jun 27 06:27:34 CV-base uwsgi[19530]: --- no python application found, check your startup logs for errors ---
Jun 27 06:27:34 CV-base uwsgi[19530]: [pid: 19538|app: -1|req: -1/3] 134.17.26.62 () {44 vars in 862 bytes} [Thu Jun 27 06:27:34 2019] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

Я долблюсь второй день, очень нужна помощь!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Kuzmichev, 2019-06-27
@Lepilov

[uwsgi]
project = cv-base
...
chdir = %(base)/%(project)/ems
...
module = %(project).wsgi:application

In total, you get what moduleturns into , but there is no cv-base cv-base.wsgi:applicationinside your project tree . chdirProbably the value moduleshould beems.wsgi:application

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question