Easiest way to update live app with development app?

I have an app that is live and hosted on a remote server using a custom domain. I have another version of the app that I’ve been developing on my local machine with extra features and differences in the design aspect.
I want to update the live app with the changes I’ve made to the developement app. What’s the easiest and correct way to do this? Bearing in mind there are quite a few design differences to the developement version of the app and the fact that the live app is also on a custom domain?
I can think of a couple of ways I could do this, but I figure there is probably a correct way to do it and as I’m not a developer I’m not entirely sure how best to proceed.

Thank you in advance
Adam

When you say that you have been developing on a local machine do you mean that you have a completely separate app that you have been working on?

If you need to import another app into another you could use depedencies: Is there an easy way to create an API in Anvil? - #2 by stefano.menci

We use the Anvil version control to push changes to production (also custom domain). General flow looks like this:

  1. Create a new branch for development,
  2. Make changes
  3. Merge changes with master
  4. Reset production to the new merged position

More info here Anvil Docs | Version Control

Yes, it’s a completely different app. I messed up when I tried to use version control and develop a different branch of the same app and wasted a load of work, so instead I made a clone of the app, renamed it and developed that, so yes essentially 2 different apps.

Are you on a plan that supports different staging environments? e.g. Professional and above? That’s by far the easiest way to separate development and production versions.

The way you’re currently doing it, with separate apps, is the way it used to be done before the new editor allowed different staging environments and branches. To deploy changes from the one app to another you need to download the development app to your local machine using git, set up the production app as a remote, and push to the production app.

There used to be a help page detailing how to do that for the classic editor. I’ll try to hunt that up and post the link here if I can find it. Here’s the link: Anvil Docs | Apps in development and production

Honestly, though, if you’re on a plan that supports staging environments in the current editor, it’s worth the work to figure out how to use them. They’re far less effort.

2 Likes

Great thanks, I’d read that doc a while ago, but couldn’t find it again.

If you are familiar with git, clone both apps to your computer, copy the files from one app to the other, commit and push.

If you are not, come back here and ask for details :slightly_smiling_face:

1 Like

To be honest I’ve tried to use Git, but have generally just created problems for myself. I’ve watched a few videos on it and it seems quite simle to use, but in reality I’ve not found it very intuitive. Most likely because I’m an amateur and not a developer and this is all quite new to me.
At this point the simplest way forward, in my mind, to me seems to be to push my developement app uplink script to the remote server, swap the uplink code with the uplink code from the live app and then rename the developement app with the name of the live app. I’ll then switch the old live app back to a private link and switch the new live app to the custom domain. However, I’m unclear as to whether that will require any intervention by the Anvil team, as it did when I originally put the live app on the custom domain.

I did what I wrote above and after updating any hardcoded URL’s and re-directing stripe web-hooks it seemed to work. All except when I go to reset an users password via the custon login/registration flow. The app crashes with the error:
‘ValueError: dictionary update sequence element #0 has length 3; 2 is required’

When I look at the console I have this error 7 times:
‘Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://anvil.works’) does not match the recipient window’s origin (‘https://app.sn4pshot.com’).’

Followed by the same ‘Python exception: ValueError: dictionary update sequence element #0 has length 3; 2 is required’

And: ‘Uncaught (in promise) constructor’ /#reset_password?ema…affe-54833a631d2b:1

and Failed to load resource: the server responded with a status of 404 (Not Found)

My research tells me this is a ‘cross-origin communication issue’ and as it worked just fine before I moved it to my custom domain, I’m thinking maybe just pointing the development app at my custom domain without any intervention from Anvil support could be the root of the issue.

Anyone have an idea on this?

Other than that it appears to be functioning correctly.

Git is the least intuitive software in the world. No one knows how to use everything git allows to do. I know the basics and I don’t use that either. I use the version control tools inside PyCharm, so I don’t need to know how to use git because PyCharm does it for me, and I get diff and other goodies for free. You can use the free version of PyCharm just so you can use git with your apps.

You can use the clone with git button on each Anvil app to copy the command that clones the repository to your computer. Create two folders, clone each app to its own folder, start PyCharm, create a new project, select the folder that contains both the git folders, and you will see the two git repositories inside the same project.

Then you copy the files from one app to the other, commit and push.

Then you go to the Anvil Ide and you will see that the new version is available for you to test.

You can screw up and destroy your app, but even if you do, you can always reset the publisher branch back were it was when it was working.

Learning how to use git with PyCharm will take a little time, but very likely less time than troubleshooting your manual app switch, and then you will have a new tool in your arsenal.

1 Like

Thanks Stefano, I will look into it.