Django没有名为"压缩器"的模块

joh*_*ohn 8 python django django-compressor visual-studio-2015

我正在尝试使用cmd创建一个超级用户,但每次我运行命令时我都会:

C:\Users\PCDOM\Desktop\Power\pm_app>python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
338, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
312, in execute
    django.setup()
  File "C:\Python27\lib\site-packages\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Python27\lib\site-packages\django\apps\registry.py", line 85, in popu
late
    app_config = AppConfig.create(entry)
  File "C:\Python27\lib\site-packages\django\apps\config.py", line 86, in create

    module = import_module(entry)
  File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named compressor
Run Code Online (Sandbox Code Playgroud)

即使我在我的虚拟环境和settings.py中安装了它:

在此输入图像描述

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    #'bootstrap3',
    'promo',
    'ums',
    'compressor',
    #'sqlserver_ado',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
)

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    #'django.contrib.staticfiles.finders.DefaultStorageFinder',
    'compressor.finders.CompressorFinder',
)
Run Code Online (Sandbox Code Playgroud)

任何理由django都在向我施加压力?

joh*_*ohn 13

所以我不得不使用我的本地点来安装django-compressor,所以出于某种原因它没有使用我的虚拟环境压缩器

  • 缺少的包是`django-compressor`**NOT**`django_compressor` (6认同)

cry*_*KTM 5

您需要在 Venv 中重新安装 django_compressor

 pip install django_compressor
Run Code Online (Sandbox Code Playgroud)