im building a survey. I host the app in custom domain and i save the data in the database provide by anvil. This information may be useful
So, the problem arose when i tried to finish the survey hosted in my domain( which is https://tesispensiones.com/). The app freezes and didn’t add the responses to the database, so i then tried too see if the debug versions was fine, and for my surprise it does work. So I don’t know if this is a issue with the code or a website issue. Im also a beginner when it comes to Python and web development, so i would appreciate any recommendations
I will put a Clone of my app in case anyone wants to see my code. Anvil | Login
I had a look at your app, and I don’t see any reason why it should work in debug and not work when running on a custom domain.
While I was trying it I noticed that there is no validation and when you enter the wrong values on some forms it shows an error on the app console.
My guess is that when you debug you see the error, correct the error and proceed to the next form. At the end all data is there and it works. When you run from the domain you don’t have the console app, you don’t see the error, you plow through it without fixing input errors, and at the end it fails when it tries to save to the database.
You can try to look at the app logs and see if you see any feedback from the app running on the custom domain.
You can sprinkle print("I'm here") statements so you can look at the log and can trace where was the app:
print('writing to database')
app_tables.tesis.add_row(block=respons[0],
acepto=respons[1],
f_literacy1=respons[2],
[...],
investment6=respons[69],
correo=respons[70])
print('done writing to database')
open_form('Final')
The first time you set the custom domain you need to wait some time (can be minutes, hours or more than one day), but once it has been setup and working, any change you make to the app is immediately live.
Hmmm, that’s not the way its has been working my domain, sometimes takes hours, sometimes is immediately. But even if that’s the case it didn’t workout im trying now with the Tony solution
The reason why it takes time the first time you set it up, has nothing to do with Anvil. The DNS servers around the world need to know where to go when your domain is looked up, and it takes time for the whole world to know about you.
After that has been setup, all happens in Anvil. When one client looks for that domain, Anvil serves your app, which is immediately available after each editing.
If you edit your app and don’t see the changes in the app running on the custom domain, perhaps you need to publish if you are working on the old editor or you need to merge from the development to the published environment if you work on the new editor.
Tony did not answer your question, he just gave you a general advice. A good one, but it has nothing to do with your question.
ohh i see, but it’s not working that way anyway. I change the text that appears under the Title from 2.1 to 2.1.1 that was 20 minutes ago, and i still see the former.
I do have a branch were i do the changes, and that is not published one. The master branch is the one with the 2.1.1 text.
While i was writing this , the website just charged the updated version
Well i did it, but it still taking time. Since 2 minutes ago i made the changes in both branches and if u open https://tesispensiones.com/ it still appers 2.1.1 but right now the text says Hi and the other branch Hi 2. I actually open it in a diff browser to see if that makes any difference but it was not the case
I clicked on your link and I got a “We could not find an app that matched your request” message. Did you play with the environment settings?
I never had to wait to see the changes in the app after editing it and I’ve never seen the custom url stopping working like this.
I would create a new environment, link it to the custom url, wait for it to work and never touch its configuration again. After that, any change to the code in that environment, whether it is a merge from another branch or an edit done directly in the environment’s branch, will immediately be live in the custom url.
But in the mean time you can ignore this problem and work on the app.
If you mean you changed the domain setting so the public url doesn’t see the app anymore, that’s your problem.
Once you set the custom domain, you must never touch that setting again.
If you don’t want the app to be visible you can create a form with a “work in progress” label and set that form as the startup form.
Later, when you are done editing your changes in another branch, you can merge that branch to the custom domain one, or reset the branch of the custom domain environment to the development branch, and the app will be working.
If you want to turn it off again, you can set the work in progress form as startup form in the custom domain environment and keep developing in the development environment.
I did change the url to a public domain, there were people who had the link and were triying to do the survey, and was a bit frustating for me. So i just change the url hahah.
@niko.hu.pa: this is a note for Tony, not for you, sorry for hijacking your thread with this. And I hope you didn’t waste too much time working on Tony’s advice while trying to find a solution to your problem.
@Tony.Nguyen, I see that you keep stating universal truths, in this thread alone you did it twice.
Once was to give a good advice that has nothing to do with the question. That was not exactly what Nico needed.
And once pulling something out of nowhere that doesn’t fit in this discussion at all.
This is a public forum and any contribution is welcome, but you should think about the person who asks the question today and any reader in the future.
Instead of stating “This is exactly what you need” you should say “I don’t have an answer for your question, but I have an unrelated advice”. Much less confusing for Nico today and for any future reader.