mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Allow app names for datasette publish heroku
Lets you supply the `-n` parameter for Heroku deploys, which also lets you update existing Heroku deployments.
This commit is contained in:
parent
31a5d8fa77
commit
58fec99ab0
2 changed files with 25 additions and 6 deletions
|
|
@ -100,7 +100,7 @@ def inspect(files, inspect_file, sqlite_extensions):
|
||||||
"-n",
|
"-n",
|
||||||
"--name",
|
"--name",
|
||||||
default="datasette",
|
default="datasette",
|
||||||
help="Application name to use when deploying to Now (ignored for Heroku)",
|
help="Application name to use when deploying",
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-m",
|
"-m",
|
||||||
|
|
@ -259,10 +259,29 @@ def publish(
|
||||||
install,
|
install,
|
||||||
extra_metadata,
|
extra_metadata,
|
||||||
):
|
):
|
||||||
create_output = check_output(["heroku", "apps:create", "--json"]).decode(
|
|
||||||
"utf8"
|
app_name = None
|
||||||
)
|
if name:
|
||||||
app_name = json.loads(create_output)["name"]
|
# Check to see if this app already exists
|
||||||
|
list_output = check_output(["heroku", "apps:list", "--json"]).decode('utf8')
|
||||||
|
apps = json.loads(list_output)
|
||||||
|
|
||||||
|
for app in apps:
|
||||||
|
if app['name'] == name:
|
||||||
|
app_name = name
|
||||||
|
break
|
||||||
|
|
||||||
|
if not app_name:
|
||||||
|
# Create a new app
|
||||||
|
cmd = ["heroku", "apps:create"]
|
||||||
|
if name:
|
||||||
|
cmd.append(name)
|
||||||
|
cmd.append("--json")
|
||||||
|
create_output = check_output(cmd).decode(
|
||||||
|
"utf8"
|
||||||
|
)
|
||||||
|
app_name = json.loads(create_output)["name"]
|
||||||
|
|
||||||
call(["heroku", "builds:create", "-a", app_name])
|
call(["heroku", "builds:create", "-a", app_name])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ This will output some details about the new deployment, including a URL like thi
|
||||||
|
|
||||||
https://limitless-reef-88278.herokuapp.com/ deployed to Heroku
|
https://limitless-reef-88278.herokuapp.com/ deployed to Heroku
|
||||||
|
|
||||||
You can then set a custom subdomain by navigating to your new app's equivalent of ``https://dashboard.heroku.com/apps/limitless-reef-88278/settings`` and editing the name of your deployment, e.g. to http://datasette-publish-demo.herokuapp.com/
|
You can specify a custom app name by passing ``-n my-app-name`` to the publish command. This will also allow you to overwrite an existing app.
|
||||||
|
|
||||||
Custom metadata and plugins
|
Custom metadata and plugins
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue