开发者

Django filebrowser extensions configuration error

开发者 https://www.devze.com 2023-02-28 21:59 出处:网络
Where should I put the extension setting for filebrowser. I put the filebrowser extension configuration into the root settings.py:

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, becaus开发者_如何学Goe environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.


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!


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
0

精彩评论

暂无评论...
验证码 换一张
取 消