Generate more useful data that can be used with addons-frontend. (#9289)

This is needed for mozilla/addons-nginx#7 and #9080 to be more useful.
The data that `generate_ui_test_addons` generates can directly be used
in the new frontend homepage.

This PR also stops seamonkey and thunderbird add-ons to be generated
by default.
This commit is contained in:
Christopher Grebs 2018-08-29 16:13:22 +02:00 коммит произвёл GitHub
Родитель 3c69420e67
Коммит 2571832756
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -86,10 +86,13 @@ populate_data:
# make sure the mapping is correct before adding a bunch of add-ons.
python manage.py reindex --wipe --force --noinput
python manage.py generate_addons --app firefox $(NUM_ADDONS)
python manage.py generate_addons --app thunderbird $(NUM_ADDONS)
python manage.py generate_addons --app android $(NUM_ADDONS)
python manage.py generate_addons --app seamonkey $(NUM_ADDONS)
python manage.py generate_themes $(NUM_THEMES)
# These add-ons are specifically useful for the addons-frontend
# homepage. You may have to re-run this, in case the data there
# changes.
python manage.py generate_default_addons_for_frontend
# Now that addons have been generated, reindex.
python manage.py reindex --force --noinput
# Also update category counts (denormalized field)
@ -164,7 +167,7 @@ setup-ui-tests:
run-ui-tests: setup-ui-tests
# Generate test add-ons and force a reindex to make sure things are updated
pip install --progress-bar=off --no-deps -r requirements/uitests.txt
python manage.py generate_ui_test_addons
python manage.py generate_default_addons_for_frontend
python manage.py reindex --force --noinput --wipe
pytest --driver Firefox tests/ui/

Просмотреть файл

@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from django.core.cache import cache
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.utils import translation
from django.test.utils import override_settings
from django.db.models.signals import post_save
from olympia.landfill.serializers import GenerateAddonsSerializer
from olympia.addons.models import Addon, update_search_index
# Featured collections on the homepage.
# Needs to be updated as the homepage is updated
@ -61,11 +62,16 @@ class Command(BaseCommand):
Usage:
python manage.py generate_ui_test_addons
python manage.py generate_default_addons_for_frontend
"""
def handle(self, *args, **kwargs):
# Disconnect reindexing for every save, we'll reindex
# once all addons were generated
post_save.disconnect(update_search_index, sender=Addon,
dispatch_uid='addons.search.index')
with override_settings(CELERY_ALWAYS_EAGER=True):
translation.activate('en-US')
serializer = GenerateAddonsSerializer()
@ -83,5 +89,3 @@ class Command(BaseCommand):
for addon in hero_addons:
serializer.create_named_addon_with_author(addon)
serializer.create_installable_addon()
cache.clear()
call_command('clear_cache')