Hi Simon,

You are right. Package easy_select2 calls the url method, which you can see 
here:
https://github.com/asyncee/django-easy-select2/blob/master/easy_select2/widgets.py#L32

I'm going to report them that problem and I'll try also find a solution.

Cheers
Andrzej

W dniu sobota, 9 stycznia 2016 04:20:28 UTC+1 użytkownik Simon Charette 
napisał:
>
> Hi Andrzej,
>
> If I understand correctly you can't run `collectstatic` with `DEBUG = 
> False`
> if you didn't run it with `DEBUG = True` beforehand.
>
> I can't be sure without the full traceback but I suspect one of your
> applications calls 
> `django.contrib.staticfiles.storage.staticfiles_storage.url`
> at module level triggering the `ValueError` since the hashed path to the
> specified asset has not been computed and cached yet.
>
> If you want to use `CachedStaticFilesStorage` you'll have to make sure not 
> to
> issue such calls in modules loaded when `collectstatic` runs.
>
> Could you possible share the full traceback of the error raised when
> `collectstatic --traceback` is run.
>
> Simon
>
> Le vendredi 8 janvier 2016 15:36:54 UTC-5, Andrzej Mateja a écrit :
>>
>> Thank you Simon for sharing your remarks although it is not the case what 
>> you described. I'm talking about deploying brand new project which is 
>> depending on external application with its own static files. Project should 
>> have also no static files collected yet, static files cashing enabled 
>> (using CachedStaticFilesStorage) and empty cache. In such scenario I always 
>> get ValueError exception in hashed_name method from HashedFilesMixin 
>> class. I'm never able to complete collectstatic with DEBUG = False. My 
>> workaround is:
>> 1. set DEBUG = True
>> 2. run python manage.py collectstatic
>> 3. set DEBUG = False
>> 4. run python manage.py collectstatic again
>>
>> In step 2. all static files from external application are copied to 
>> STATIC_ROOT which enables me to proceed. This workaround is not very 
>> beautiful nor django-like. Why? Because there is no such behaviour when I 
>> fell back to default StaticFilesStorage.
>>
>> Andrzej
>>
>> W dniu piątek, 8 stycznia 2016 19:31:17 UTC+1 użytkownik Simon Charette 
>> napisał:
>>>
>>> Hi Andrzej,
>>>
>>> CachedStaticFilesStorage requires you run `collectstatic` before 
>>> deploying
>>> your application in production (non-DEBUG) mode.
>>>
>>> The deployment should look like that:
>>>
>>> 1) Update your code to the latest version.
>>> 2) Run `collectstatic` to cache paths to hashed versions of your assets.
>>> 3) Restart your server.
>>>
>>> Simon
>>>
>>> Le vendredi 8 janvier 2016 09:19:30 UTC-5, Andrzej Mateja a écrit :
>>>>
>>>> Hi,
>>>>
>>>> I have a problem with using CachedStaticFilesStorage as a 
>>>> STATICFILES_STORAGE and with external package containing its own static 
>>>> files (easy_select2 to be specific). If I deploy my project for the very 
>>>> first time with DEBUG = False, empty cache and no external package static 
>>>> files copied to STATIC_ROOT I got an exception: *ValueError: The file 
>>>> 'easy_select2/js/init.js' could not be found with 
>>>> <django.contrib.staticfiles.storage.CachedStaticFilesStorage object at 
>>>> 0xffffffffffff>*. with every manage.py command, especially 
>>>> collectstatic. I understand that behaviour of HashedFilesMixin is legit 
>>>> but 
>>>> I'm not so sure if it should be like that when I want to collect my static 
>>>> files.
>>>>
>>>> As a workaround I set temporally DEBUG = True, run manage.py 
>>>> collectstatic, set DEBUG back to False and do the rest. But I have a 
>>>> feeling that it is not the right way to do it especially because there is 
>>>> no problem when StaticFilesStorage is used - no need to do such tricks.
>>>>
>>>> Best regards
>>>> Andrzej
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9b9aa065-3399-435a-9f59-24fb50b45d1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to