Nhor
Nhor

Reputation: 3950

Django TypeError after installing tinymce

after installing tinymce and just including it to INSTALLED_APPS in settings.py I get this error when I'm trying to run local server:

(django) \mypath\ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\venv\django\lib\site-packages\django\core\management\__init__.py", line 385, in execute_f
rom_command_line
    utility.execute()
  File "C:\venv\django\lib\site-packages\django\core\management\__init__.py", line 354, in execute
    django.setup()
  File "C:\venv\django\lib\site-packages\django\__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\venv\django\lib\site-packages\django\apps\registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "C:\venv\django\lib\site-packages\django\apps\config.py", line 197, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Python27\Lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\venv\django\lib\site-packages\tinymce\models.py", line 6, in <module>
    from tinymce import widgets as tinymce_widgets
  File "C:\venv\django\lib\site-packages\tinymce\widgets.py", line 10, in <module>
    import tinymce.settings
  File "C:\venv\django\lib\site-packages\tinymce\settings.py", line 16, in <module>
    JS_ROOT = getattr(settings, 'TINYMCE_JS_ROOT',os.path.join(settings.STATIC_ROOT, 'tiny_mce'))
  File "C:\venv\django\lib\ntpath.py", line 64, in join
    result_drive, result_path = splitdrive(path)
  File "C:\venv\django\lib\ntpath.py", line 114, in splitdrive
    if len(p) > 1:
TypeError: object of type 'NoneType' has no len()

I have no idea what is happening because I didn't even start messing with files to actually use tinymce in the project. When I simply remove 'tinymce' from INSTALLED_APPS it returns to normal but the thing is I really need tinymce. I made sure several times that tinymce is installed with pip. Here's how my settings.py look like:

"""
Django settings for mysite project.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '***'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'tinymce',
    'interface',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.core.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    "interface.context_processor.global_vars"
)

ROOT_URLCONF = 'mysite.urls'

WSGI_APPLICATION = 'mysite.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATIC_URL = '/static/'

I'd appreciate any help, thanks in advance.

Upvotes: 1

Views: 545

Answers (2)

Chris Hawkes
Chris Hawkes

Reputation: 12430

It seems you need to have your STATIC_ROOT/URL set in your settings.py.

Upvotes: 2

gurel_kaynak
gurel_kaynak

Reputation: 554

try setting TINYMCE_JS_ROOT to your tinymce js folder in your settings.py. From what I can tell from your error output this setting is missing.

Upvotes: 0

Related Questions