kelvinfix
kelvinfix

Reputation: 3075

Django filebrowser extensions configuration error

Where should I put the extension setting for filebrowser.

I put the filebrowser extension configuration into the root settings.py:

from django.conf import settings

FILEBROWSER_EXTENSIONS = getattr(settings, "FILEBROWSER_EXTENSIONS", {
    'Image': ['.jpg','.jpeg','.gif','.png','.tif','.tiff'],
    'Document': ['.pdf','.doc','.rtf','.txt','.xls','.csv'],
    'Video': ['.mov','.wmv','.mpeg','.mpg','.avi','.rm'],
    'Audio': ['.mp3','.mp4','.wav','.aiff','.midi','.m4p']
})

When i try to start the server, I get this error:

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    import settings
  File "/home/kelvin/workspace/exam/settings.py", line 177, in <module>
    'Audio': ['.mp3','.mp4','.wav','.aiff','.midi','.m4p']
  File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 276, in __getattr__
    self._setup()
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 40, in _setup
    raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

Upvotes: 0

Views: 432

Answers (2)

Daniel Roseman
Daniel Roseman

Reputation: 600059

Have you put that first code block inside your main settings.py? That can't work, because you're actually importing the main settings inside itself!

Upvotes: 1

damir
damir

Reputation: 1978

This kind of error appears if you try to exec one of django modules on it's own. Just add your application to settings.INSTALLED_APPLICATIONS and that should be enough. Alternatively I think maybe you are trying to import wrong settings file, try

import filebrowser.settings

Upvotes: 0

Related Questions