Django.fun

TypeError: 'module' object is not iterable under nginx+uwsgi+django+centos7 Never seen before

I have an annoying problem thest days.There are errors from uwsgi.log in the project I am creating:

Traceback (most recent call last):

File "/root/Envs/magicmall2/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner File "/root/Envs/magicmall2/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner Traceback (most recent call last): File "/root/Envs/magicmall2/lib/python3.6/site-packages/django/urls/resolvers.py", line 409, in url_patterns response = get_response(request) File "/root/Envs/magicmall2/lib/python3.6/site-packages/django/core/handlers/base.py", line 172, in _get_response Traceback (most recent call last): iter(patterns) File "/root/Envs/magicmall2/lib/python3.6/site-packages/django/urls/resolvers.py", line 409, in url_patterns TypeError: 'module' object is not iterable

django.core.exceptions.ImproperlyConfigured: The included URLconf 'magic_mall.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

the project is running fine on my windows laptop.but couldn't work properly while i am deploying on server.

uwsgi.ini

[uwsgi]
socket=192.168.17.128:8001
# http=192.168.199.133:8001
chdir=/root/Desktop/MagicMall/magic_mall
wsgi-file=magic_mall/wsgi.py
processes=4
threads=2
master=True
pidfile=uwsgi.pid
daemonize=uwsgi.log
virtualenv=/root/Envs/magicmall2

nginx.conf

http {
include       mime.types;
default_type  application/octet-stream;


sendfile        on;
keepalive_timeout  65;
upstream magicmall {
server 192.168.17.128:8001; 
}

#gzip  on;

server {
    listen       80;
    server_name  www.magicmall.com;
location /admin {
    include uwsgi_params;
    uwsgi_pass magicmall;
}

location /ckeditor {
    include uwsgi_params;
    uwsgi_pass magicmall;
}

    location / {
        root   /root/Desktop/front_end_pc;
        index  index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

}

server {
    listen       8000;
    server_name  api.magicmall.com;

    location / {
        include uwsgi_params;
        uwsgi_pass magicmall;
    }
}

}

Tutorials

Современный Python: начинаем проект с pyenv и poetry

Настройка проекта Python — виртуальные среды и управление пакетами

Использование requests в Python — тайм-ауты, повторы, хуки

Понимание декораторов в Python

ProcessPoolExecutor в Python: полное руководство

map() против submit() с ProcessPoolExecutor в Python

Понимание атрибутов, словарей и слотов в Python

Полное руководство по slice в Python

Выпуск Django 4.0

Безопасное развертывание приложения Django с помощью Gunicorn, Nginx и HTTPS

Автоматический повтор невыполненных задач Celery

Django REST Framework и Elasticsearch

Докеризация Django с помощью Postgres, Gunicorn и Nginx

Асинхронные задачи с Django и Celery

Релизы безопасности Django: 3.2.4, 3.1.12 и 2.2.24

Выпуски исправлений ошибок Django: 3.2.3, 3.1.11 и 2.2.23

Эффективное использование сериализаторов Django REST Framework

Выпуски безопасности Django: 3.2.2, 3.1.10 и 2.2.22

Выпущенные релизы безопасности Django: 3.2.1, 3.1.9 и 2.2.21

Обработка периодических задач в Django с помощью Celery и Docker

View all tutorials →