Django使用simpleui来美化后台,ModuleNotFoundError: No module named ‘simpleui‘

Django美化后台很方便,首先我们要 pip install django-simpleui,

(firstEvn) jason-macbook-pro:test3 wangying$ pip install django-simpleui
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting django-simpleui
  Downloading http://mirrors.aliyun.com/pypi/packages/c7/29/858dbebc1774bb88e7e2e8273b043adecbf41e35ddd7c256dab2722a02f5/django-simpleui-2020.7.tar.gz (3.1 MB)
     |████████████████████████████████| 3.1 MB 8.1 MB/s 
Requirement already satisfied: django in /Users/wangying/.virtualenvs/firstEvn/lib/python3.7/site-packages (from django-simpleui) (3.0.8)
Requirement already satisfied: pytz in /Users/wangying/.virtualenvs/firstEvn/lib/python3.7/site-packages (from django->django-simpleui) (2020.1)
Requirement already satisfied: asgiref~=3.2 in /Users/wangying/.virtualenvs/firstEvn/lib/python3.7/site-packages (from django->django-simpleui) (3.2.10)
Requirement already satisfied: sqlparse>=0.2.2 in /Users/wangying/.virtualenvs/firstEvn/lib/python3.7/site-packages (from django->django-simpleui) (0.3.1)
Building wheels for collected packages: django-simpleui
  Building wheel for django-simpleui (setup.py) ... done
  Created wheel for django-simpleui: filename=django_simpleui-2020.7-py3-none-any.whl size=3544253 sha256=d1c5f95571beec88cb6fa8d1ccded5bf0d5f0e624ac1ff4780bc7c576c8b138d
  Stored in directory: /Users/wangying/Library/Caches/pip/wheels/a7/24/a3/1fadaa57b56a56e23c7e9f327f2b8378d9bcfcde613e473863
Successfully built django-simpleui
Installing collected packages: django-simpleui
Successfully installed django-simpleui-2020.7

确保安装成功后,在INSTALLED_APPS里面添加'simpeui'

INSTALLED_APPS = [
    'simpleui',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

]

然后python manage.py runserver运行程序,如果没有报错就可以打开admin后台查看了,发现变成新的界面了

如果提示

    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1006, in _gcd_import
  File "", line 983, in _find_and_load
  File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'simpleui'

解决办法:

我们先把'simpeui'放到最下面运行下runserver,打开后台可以看下,发下没有变化,然后在把'simpeui'放到最上面运行下runserver,发现变成新的后台了,而且没有报错信息了

到现在还没查出来具体是什么原因,预计还是跟缓存有关系。

你可能感兴趣的:(python3)