update-authors-json: Write to static, not STATIC_ROOT.

Otherwise the file isn’t processed by collectstatic and doesn’t end up
in the staticfiles.json manifest.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-07-18 14:39:36 -07:00
committed by Tim Abbott
parent 1d05a71b5d
commit 5f712b960f
2 changed files with 10 additions and 14 deletions

View File

@@ -21,10 +21,6 @@ from datetime import date
import requests
import json
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
from django.conf import settings
FIXTURE_FILE = os.path.join(os.path.dirname(__file__), '../zerver/tests/fixtures/authors.json')
duplicate_commits_file = os.path.join(os.path.dirname(__file__),
'../zerver/tests/fixtures/duplicate_commits.json')
@@ -144,7 +140,7 @@ def run_production() -> None:
contributor_data['name'] = contributor_name
data['contrib'].append(contributor_data)
write_to_disk(data, settings.CONTRIBUTORS_DATA)
write_to_disk(data, 'static/generated/github-contributors.json')
def copy_fixture() -> None:
@@ -152,7 +148,7 @@ def copy_fixture() -> None:
Copy test fixture file from zerver/tests/fixtures. This is used to avoid
constantly fetching data from Github during testing.
"""
shutil.copyfile(FIXTURE_FILE, settings.CONTRIBUTORS_DATA)
shutil.copyfile(FIXTURE_FILE, 'static/generated/github-contributors.json')
if args.use_fixture:

View File

@@ -52,6 +52,14 @@ run(['./tools/setup/build_pygments_data'], stdout=fp, stderr=fp)
# Create webpack bundle
run(['./tools/webpack'], stdout=fp, stderr=fp)
# Generate /team page markdown for authors
authors_cmd = ['./tools/update-authors-json']
if os.environ.get("TRAVIS"):
authors_cmd.append("--use-fixture")
if args.authors_not_required:
authors_cmd.append("--not-required")
run(authors_cmd, stdout=fp, stderr=fp)
# Collect the files that we're going to serve; this creates prod-static/serve.
run(['./manage.py', 'collectstatic', '--no-default-ignore',
'--noinput', '-i', 'assets', '-i', 'js', '-i', 'styles', '-i', 'templates'],
@@ -67,12 +75,4 @@ run(['./manage.py', 'compilemessages'], stdout=fp, stderr=fp)
# Needed if PRODUCTION
os.makedirs('prod-static', exist_ok=True)
# Generate /team page markdown for authors
authors_cmd = ['./tools/update-authors-json']
if os.environ.get("TRAVIS"):
authors_cmd.append("--use-fixture")
if args.authors_not_required:
authors_cmd.append("--not-required")
run(authors_cmd, stdout=fp, stderr=fp)
fp.close()