Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reload sitetree with sitetree_resync_apps #166

Closed
acidjunk opened this issue Jul 28, 2015 · 8 comments
Closed

reload sitetree with sitetree_resync_apps #166

acidjunk opened this issue Jul 28, 2015 · 8 comments
Labels

Comments

@acidjunk
Copy link

When I run python manage.py sitetree_resync_apps in my Django 1.7 or Django 1.8 stack; it seems like sitetree menu isn't correctly updated. I write "seems"; because I believe it's updated OK; but due to items still being in the cache you don't see it on the site or in the admin menu.

As I don't know in which cache it is; or how to delete it; my current workflow consist of: delete site tree items in admin menu manually, run python manage.py sitetree_resync_apps; this feel rather tedious when some URL's have to be added to the site tree; and you have to debug it a couple of times.

I even tried to clear the cache by writing an extra management command:

from django.core.management.base import BaseCommand
from sitetree.models import Tree
from django.core.cache import cache

class Command(BaseCommand):
    args = ''
    help = 'Will delete the sitetree so it can be repopulated. This eases automated deployment.'

    def delete_sitetrees(self):
        Tree.objects.all().delete()
        self.stdout.write('Deleted all sitetrees')
        cache.clear()
        self.stdout.write('Cleared site cache')

    def handle(self, *args, **options):
        self.delete_sitetrees()

But this doesn't seem to work. Is there a way to force the cache to be flushed, or am I doing something wrong?

BTW: This issues could be related with #135

@idlesign
Copy link
Owner

Thank you for the report.
I'll check whether these two issues are related, and try to do something to improve the situation in a couple of days.

@idlesign idlesign added the bug label Jul 29, 2015
@idlesign
Copy link
Owner

Here and in #135 is cache invalidation issue: SiteTree stores intermediate cache that needs to be invalidated from another process (manage). We'd probably end up with intermediate cache dropped.

@acidjunk
Copy link
Author

Thanks for your quick reply :)
are the any know workarounds to clear the cache? I'm using default backend (e.g. no cache settings whatsoever in settings)

@idlesign
Copy link
Owner

I've implemented an utility mehtod to reset cache, yet it requires cache to be set for something other than LocalMemory. You can verify the solution works in master.

@acidjunk
Copy link
Author

I will test it in a moment. Thanks for the quick response.

@acidjunk
Copy link
Author

I believe it works ok. (have to reload the dev webserver to see changes but that's ok)
Will test this soon in production.

@idlesign
Copy link
Owner

[...] have to reload the dev webserver to see changes but that's ok [...]

It shouldn't be necessary. What's your workflow?

@acidjunk
Copy link
Author

I change something in my file with urls (sitetrees.py); then I run python manage.py sitetree_resync_apps;
then I reload dev webserver and menu is correct in admin and site.

I don't have Cache settings at all. (using default django cache settings)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants