jackson...@gmail.com
unread,Feb 26, 2009, 6:13:24 PM2/26/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I try to make my own custom storage like:
from django.core.files.storage import Storage
CUSTOM_MEDIA_ROOT = 'blah'
CUSTOM_MEDIA_URL = 'bleh'
class MediaStorage(Storage):
def __init__(self, location=CUSTOM_MEDIA_ROOT,
base_url=CUSTOM_MEDIA_URL, *args, **kwargs):
super(MediaStorage, self).__init__(*args, **kwargs)
self.location = os.path.abspath(location)
self.base_url = base_url
, but when i put that custom storage in the settings:
DEFAULT_FILE_STORAGE = 'path_to_my_custom_storage'.MediaStorage
and i try to restore the database django raise this error:
...
from django.core.files.storage import Storage
File "/usr/lib/python2.5/django/core/files/storage.py", line 118, in
<module>
class FileSystemStorage(Storage):
File "/usr/lib/python2.5/django/core/files/storage.py", line 124, in
FileSystemStorage
def __init__(self, location=settings.MEDIA_ROOT,
base_url=settings.MEDIA_URL):
File "/usr/lib/python2.5/django/conf/__init__.py", line 28, in
__getattr__
self._import_settings()
File "/usr/lib/python2.5/django/conf/__init__.py", line 57, in
_import_settings
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.
Somebody help?