mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Moved datasette build to a post_compile hook.
This commit is contained in:
parent
f48cb705d8
commit
6eb23d2143
2 changed files with 2 additions and 4 deletions
|
|
@ -73,10 +73,6 @@ def publish(publisher, files, name, metadata, extra_options, force, **extra_meta
|
||||||
elif publisher == 'heroku':
|
elif publisher == 'heroku':
|
||||||
# FIXME: need to verify we have heroku, heroku-builds, and are logged in (ugh)
|
# FIXME: need to verify we have heroku, heroku-builds, and are logged in (ugh)
|
||||||
with temporary_heroku_directory(files, name, metadata, extra_options, extra_metadata):
|
with temporary_heroku_directory(files, name, metadata, extra_options, extra_metadata):
|
||||||
# build(files) doesn't work, dunno why
|
|
||||||
app = Datasette(files)
|
|
||||||
open("inspect-data.json", 'w').write(json.dumps(app.inspect(), indent=2))
|
|
||||||
|
|
||||||
create_output = check_output(['heroku', 'apps:create', '--json'])
|
create_output = check_output(['heroku', 'apps:create', '--json'])
|
||||||
app_name = json.loads(create_output)["name"]
|
app_name = json.loads(create_output)["name"]
|
||||||
call(["heroku", "builds:create", "-a", app_name])
|
call(["heroku", "builds:create", "-a", app_name])
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,8 @@ def temporary_heroku_directory(files, name, metadata, extra_options, extra_metad
|
||||||
|
|
||||||
open('runtime.txt', 'w').write('python-3.6.2')
|
open('runtime.txt', 'w').write('python-3.6.2')
|
||||||
open('requirements.txt', 'w').write('datasette')
|
open('requirements.txt', 'w').write('datasette')
|
||||||
|
os.mkdir('bin')
|
||||||
|
open('bin/post_compile', 'w').write('datasette build --inspect-file inspect-data.json')
|
||||||
|
|
||||||
quoted_files = " ".join(map(shlex.quote, files))
|
quoted_files = " ".join(map(shlex.quote, files))
|
||||||
procfile_cmd = f'web: datasette serve --host 0.0.0.0 {quoted_files} --cors --port $PORT --inspect-file inspect-data.json'
|
procfile_cmd = f'web: datasette serve --host 0.0.0.0 {quoted_files} --cors --port $PORT --inspect-file inspect-data.json'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue