marksweb / django-bleach

Bleach is a Python module that takes any HTML input, and returns valid, sanitised HTML that contains only an allowed subset of HTML tags, attributes and styles. django-bleach is a Django app that makes using bleach extremely easy.
MIT License
148 stars 23 forks source link

ModuleNotFoundError #11

Closed daneelf closed 5 years ago

daneelf commented 5 years ago

I have followed all steps to install and setup and I get this error:

ModuleNotFoundError: No module named 'django_bleachhealth_check'

marksweb commented 5 years ago

@daneelf can you provide a full stacktrace and some more info on what you've done to hit that error?

The project doesn't contain anything related to health_check which looks more like something I've seen on AWS.

daneelf commented 5 years ago

Actually, that is not the problem anymore. You are right about the AWS , but got past it. I actually get ModuleNotFoundError: No module named 'django_bleach' now. So far I have done the following:

  1. pip install django-bleach
  2. Put {% load bleach_tags %} in my template
  3. Used tag in variable: {{ title|bleach }}

Also, the project's INTALLED_APPS in settings.py looks like this:

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

    'users.apps.UsersConfig',

    'anymail',
    'corsheaders',
    'django_celery_beat',
    'django_extensions',
    'django_filters',
    'django_bleach',
    'field_history',
    'guardian',
    'rest_framework',
    'rest_framework.authtoken',
    'rest_framework_swagger',
    'rest_framework_xml',
    'storages',
    'webpack_loader',

Here is my stack trace:

Traceback (most recent call last):
   File "./manage.py", line 15, in <module>
     execute_from_command_line(sys.argv)
   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
     utility.execute()
   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
     django.setup()
   File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
     apps.populate(settings.INSTALLED_APPS)
   File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
     app_config = AppConfig.create(entry)
   File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
     module = import_module(entry)
   File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
 ModuleNotFoundError: No module named 'django_bleach'
af750cf1c50e450c8da3e8082d24ec82_worker_1 exited with code 1
 + ./manage.py check --deploy --settings=thor_backend.settings --fail-level ERROR
 Traceback (most recent call last):
   File "./manage.py", line 15, in <module>
     execute_from_command_line(sys.argv)
   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
     utility.execute()
   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
     django.setup()
   File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
     apps.populate(settings.INSTALLED_APPS)
   File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
     app_config = AppConfig.create(entry)
   File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
     module = import_module(entry)
   File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
 ModuleNotFoundError: No module named 'django_bleach'
 + ./manage.py check --deploy --settings=thor_backend.settings --fail-level ERROR
 Traceback (most recent call last):
   File "./manage.py", line 15, in <module>
     execute_from_command_line(sys.argv)
   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
     utility.execute()
   File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
     django.setup()
   File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
     apps.populate(settings.INSTALLED_APPS)
   File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
     app_config = AppConfig.create(entry)
   File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
     module = import_module(entry)
   File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
   File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
 ModuleNotFoundError: No module named 'django_bleach'
marksweb commented 5 years ago

@daneelf thanks. So it looks like the package hasn't actually been installed.

You'd need to look in /usr/local/lib/python3.6/site-packages/ to see if you can see django_bleach as an available package. If it can't import it, I can only assume it isn't there.

marksweb commented 5 years ago

@daneelf Did you find out any more information or resolve this?

marksweb commented 5 years ago

Closing this issue as I don't believe that it is a problem with the package.