only do I want to use it for media files (user uploaded files) but I
also want to use it with the collectstatic functionality. Following
the Django-storages S3 documentation, I modified my settings.py
accordingly.
Now, I ran "manage.py collectstatic" and it uploaded the media to my
bucket without any problems. I looked in my S3 control panel and all
of the files are there.
This is a stub application so the only static files included were the
Admin and Admin doc files. However, when I access the admin section of
my Django Application, the CSS is obviously missing. I looked at the
source and it doesn't appear to be grabbing the bucket URL. I'm
guessing there's something I'm missing but I'm not sure exactly what
it is. I could specify the static_files and media_files URLs manually
but from reading the documentation, I had the feeling this would be
taken care of automagically. I'm assuming this is not the case.
Code and configuration as follows:
----------------------------------------------
# in settings.py
# Amazon Storages Backend
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = '<secret>'
AWS_SECRET_ACCESS_KEY = '<secret>'
AWS_STORAGE_BUCKET_NAME = 'kurtis'
from S3 import CallingFormat
AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN
STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
# top of HTML Source Code of Admin page.
<title>Site administration | Django site admin</title>
<link rel="stylesheet" type="text/css" href="/static/admin/css/
base.css" />
<link rel="stylesheet" type="text/css" href="/static/admin/css/
dashboard.css" />
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/static/
admin/css/ie.css" /><![endif]-->
<script type="text/javascript">window.__admin_media_prefix__ = "/
static/admin/";</script>
I'm going to try setting the Static Files URL manually in hopes that
it might take care of this problem. Then I'll test out setting up an
Image Model and hope that it does pull the URL automagically. In the
mean time, if anyone has recommendations on this that would be
awesome.
Thanks!
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment