From the past 2 days i have literally lost my patience trying to make Cloudfiles work for my project(using cumulus). Here are some of the issues:
1.) Sometimes when i upload any photo using admin(creating a model and registering with admin)... the photo looks like its uploaded but when i try to either access it using a view function by Photo.objects.all() or even going to the cloudfiles control panel...the image simply doesnt open up. I get a resource not found. I check and double check if the region(chicago is default for me) settings is screwing with me....but i don't think so.
2.) I have used collectstatic method to successfully collect all static files in a container and i am able to successfully serve them. infact when i click the link(say for example) - http://ed770b871265201bf471-14f03984d90730040890dd30a2d85248.r68.cf2.rackcdn.com/admin/css/base.css
I am able to see the results and i am sure u can see it too.
But when i am trying to use them by STATIC_URL in my templates - The admin pages don't have their css working but my login/home pages are perfectly being rendered with my styles.
Here are my settings file/my view functions and anything that is important -
STATIC_ROOT = ''
STATIC_URL = 'http://ed770b871265201bf471-14f03984d90730040890dd30a2d85248.r68.cf2.rackcdn.com/'
STATICFILES_DIRS = (
os.path.join(PROJECT_DIR,'static'),
)
CUMULUS = {
'USERNAME': '***',
'API_KEY': '****',
'CONTAINER': 'photos',
'STATIC_CONTAINER':'static',
'SERVICENET': False, # whether to use rackspace's internal private network
'FILTER_LIST': [],
'TIMEOUT' : 60
}
DEFAULT_FILE_STORAGE = 'cumulus.storage.CloudFilesStorage'
STATICFILES_STORAGE = 'cumulus.storage.CloudFilesStaticStorage'
The model file part
class Photo(models.Model):
username = models.ForeignKey(User)
image = models.ImageField(upload_to='photos')
alt_text = models.CharField(max_length=255)
admin.site.register(Photo)
This is the view function as you requested kyle.
and the template for profile_detail -
I just now checked that i can view the image(No idea how) on the hosted site(production) but still can't do it in my dev environment.
Kyle can you please check if your testaccount has a picture of penguins in the 'MYProfile' page? :) Thanks for looking into it :)