How can I upload a local Anvil app to a hosted Anvil server?

How can I take an Anvil app repository that is local, and import it to an Anvil server (either to anvil.works, or an enterprise installation)?

I know how to go the other way - if I have an app on a hosted instance, I can git clone it using the History view, then run it locally with anvil-app-server --app MyDownloadedApp.

But, if, for instance, I’ve created a local app with something like create-anvil-app todo-list MyLocalTodoList, how can I then import or upload that repository to a hosted Anvil server?

I can see that when I create a new app on a anvil.works there is an “Import from file” option, which I thought might be it. I didn’t manage to find the docs on this option, but so far as I can tell by experimenting, it is intended to import an Anvil app that has been exported as a single comprehensive yaml file, and isn’t intended to import a github directory structure - is this right?

Is there a right way to do it? Any help appreciated!

I use git for that sort of thing. My workflow for dev copies of an app is at https://gist.github.com/meatballs/f362b67712dc13d62ea0d288b03bb63a

For your new app at anvil.works, you can follow the same process as my dev-app in that workflow.

e.g.

  • Create a new app at anvil.works and note its git url
  • Add that url as a remote on your local git repo
  • Force push to that remote
  • Open the app at anvil.works and fix data tables problems
2 Likes

You can also have a look at the instructions for my cookiecutter template: https://github.com/meatballs/anvil-cookiecutter

That creates a local app and there are instructions for pushing it to anvil.works

Thanks @owen.campbell ! Your post is really helpful - I saw your posts on handling anvil.yaml in git too since I’ve also been thinking about “forking” apps :slight_smile:

I did consider git force push to “import” a local app, but wondered if I was missing something more obvious. Of course going from server to local involves git, with git clone, but git clone gets a big shiny button in the Anvil UI. There is no corresponding big shiny button to go from local to server, so I just wondered if there was something obvious that I was missing, since I’m new to Anvil.