Issues

Issue #1 invalid

can't run tests

Milan Andric
created an issue

hello i might be doing something wrong, but trying to run the project tests via 'python manage.py test' fails.

{{{ Creating test database... Creating table s3project_mystorage Creating table auth_permission Creating table auth_group Creating table auth_user Creating table auth_message Creating table django_content_type Creating table django_session Creating table django_site Installing index for auth.Permission model Installing index for auth.Message model FError: Database :memory: couldn't be flushed. Possible reasons: * The database isn't running or isn't configured correctly. * At least one of the expected database tables doesn't exist. * The SQL was invalid. Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run. The full error: no such table: s3project_resume }}}

Also when I try to replicate the test commands in the shell, I get:

{{{ In [1]: from django.core.files.storage import default_storage

In [2]: print default_storage.class <class 'backends.S3Storage.S3Storage'>

In [3]: from django.db import models

In [4]: class Resume(models.Model): ...: pdf = models.FileField(upload_to='pdfs') ...: photos = models.ImageField(upload_to='photos') ...:
...:


IndexError Traceback (most recent call last)

/Users/mandric/dev/django-storages/examples/s3project/<ipython console> in <module>()

/Library/Python/2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/base.pyc in new(cls, name, bases, attrs) 49 # For 'django.contrib.sites.models', this would be 'sites'. 50 model_module = sys.modules[new_class.module] ---> 51 kwargs = {"app_label": model_module.name.split('.')[-2]} 52 else: 53 kwargs = {}

IndexError: list index out of range }}}

If it's just me, I apologize in advance.

Comments (9)

  1. adamnelson
    • changed status to open

    This is definitely still an issue. I can do the storage section of the s3 docs fine:

    >>> default_storage.exists('storage_test')
    False
    >>> file = default_storage.open('storage_test', 'w')
    >>> file.write('storage contents')
    >>> file.close()
    

    But when dealing with models, it fails. This is from the s3 example:

    >>> from models import MyStorage
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "/Users/adam/django-storages/examples/s3project/../s3project/models.py", line 12, in <module>
        class MyStorage(models.Model):
      File "/Library/Python/2.5/site-packages/django/db/models/base.py", line 51, in __new__
        kwargs = {"app_label": model_module.__name__.split('.')[-2]}
    IndexError: list index out of range
    

    In addition, the s3 example needed the following change in settings.py:

    backends.s3.S3Storage instead of backends.S3.S3Storage

  2. Log in to comment