From: Charles Connell Date: Fri, 17 Jan 2014 20:14:06 +0000 (-0500) Subject: Re-enable search indexing, S3 support for dev environment X-Git-Tag: release-20150131~229 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6675d5b8e0dac8ea4b1fae4dfed4786175f7ca96;p=oweals%2Fkarmaworld.git Re-enable search indexing, S3 support for dev environment --- diff --git a/karmaworld/apps/notes/management/commands/populate_indexden.py b/karmaworld/apps/notes/management/commands/populate_indexden.py index 8aefeb6..683f512 100644 --- a/karmaworld/apps/notes/management/commands/populate_indexden.py +++ b/karmaworld/apps/notes/management/commands/populate_indexden.py @@ -5,7 +5,7 @@ import traceback from django.core.management.base import BaseCommand from karmaworld.apps.notes.models import Note -from karmaworld.apps.notes.search import * +from karmaworld.apps.notes.search import SearchIndex class Command(BaseCommand): args = 'none' @@ -14,10 +14,11 @@ class Command(BaseCommand): "in the index that are not overwritten will still be around." def handle(self, *args, **kwargs): + index = SearchIndex() for note in Note.objects.iterator(): try: print "Indexing {n}".format(n=note) - add_document(note) + index.add_note(note) except Exception, e: traceback.print_exc() continue diff --git a/karmaworld/apps/notes/models.py b/karmaworld/apps/notes/models.py index 59625b7..7ce782b 100644 --- a/karmaworld/apps/notes/models.py +++ b/karmaworld/apps/notes/models.py @@ -20,8 +20,6 @@ from karmaworld.apps.notes.gdrive import UPLOADED_NOTES_SESSION_KEY import os import urllib -from boto.s3.acl import Grant - from django.conf import settings from django.core.files import File from django.core.files.storage import FileSystemStorage diff --git a/karmaworld/apps/notes/search.py b/karmaworld/apps/notes/search.py index 03bcfa3..d578f5d 100644 --- a/karmaworld/apps/notes/search.py +++ b/karmaworld/apps/notes/search.py @@ -114,7 +114,7 @@ class SearchIndex(object): new_note.course != old_note.course or \ new_note.uploaded_at != old_note.uploaded_at: logger.info("Indexing {n}".format(n=new_note)) - #self.index.add_document(new_note.id, SearchIndex._note_to_dict(new_note), variables={0: new_note.thanks}) + self.index.add_document(new_note.id, SearchIndex._note_to_dict(new_note), variables={0: new_note.thanks}) # If only the thanks count has changed, we can # just send that diff --git a/karmaworld/settings/common.py b/karmaworld/settings/common.py index 38381ba..4c92b55 100644 --- a/karmaworld/settings/common.py +++ b/karmaworld/settings/common.py @@ -14,6 +14,7 @@ from karmaworld.secret.filepicker import FILEPICKER_API_KEY as fp_api FILEPICKER_API_KEY = fp_api +from karmaworld.secret.static_s3 import * SERIALIZATION_MODULES = {'json-pretty': 'karmaworld.apps.serializers.json_pretty'} diff --git a/karmaworld/settings/prod.py b/karmaworld/settings/prod.py index c22f174..f80463a 100644 --- a/karmaworld/settings/prod.py +++ b/karmaworld/settings/prod.py @@ -10,8 +10,6 @@ from S3 import CallingFormat from common import * -from karmaworld.secret.static_s3 import * - from karmaworld.secret.db_settings import PROD_DB_NAME from karmaworld.secret.db_settings import PROD_DB_USERNAME from karmaworld.secret.db_settings import PROD_DB_PASSWORD diff --git a/reqs/common.txt b/reqs/common.txt index fff9644..0656fa7 100644 --- a/reqs/common.txt +++ b/reqs/common.txt @@ -20,3 +20,5 @@ gdshortener git+https://github.com/flaptor/indextank-py.git html2text django-allauth +boto==2.6.0 +django-storages==1.1.4 diff --git a/reqs/prod.txt b/reqs/prod.txt index d9eff58..e3fef51 100644 --- a/reqs/prod.txt +++ b/reqs/prod.txt @@ -1,8 +1,6 @@ -r common.txt -boto==2.6.0 cssmin==0.1.4 pylibmc==1.2.3 -django-storages==1.1.4 gunicorn==0.14.3 jsmin==2.0.2 psycopg2==2.4.5