Thanx Alex :) On Thu, Feb 26, 2009 at 6:38 PM, Alex Gaynor <alex.gay...@gmail.com> wrote:
> > > On Thu, Feb 26, 2009 at 6:13 PM, jacks...@gmail.com < > jackson.torr...@gmail.com> wrote: > >> >> 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? >> >> >> That's probably because DEFAULT_FILE_STORAGE = > 'path_to_my_custom_storage'.MediaStorage would be a typo, it should be > 'path.to.storage.MediaStorage'. > > Alex > > > -- > "I disapprove of what you say, but I will defend to the death your right to > say it." --Voltaire > "The people's good is the highest law."--Cicero > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---