Cache refresh

Hi guys,

I’ve deployed CommCareHQ on a local virtual machine so I can build
applications offline. It took a little while to sort that out but now it seems
to work : I can build applications in CommCareHQ and upload them to my
Android phone offline. So far so good.

However while setting up the VM I stumbled upon an issue.

First, I’ve followed the doc here
https://confluence.dimagi.com/display/commcarepublic/Transferring+an+Application+Between+Projects+or+Servers
to transfer a prototype application from the official CommCareHQ website to my
local VM.

Then I followed the doc in [source]/corehq/apps/builds/README.md to install
the relevant CommCare build and set up the site IP address to send the forms
to Android.

At that point downloading the profile.ccpr file works. However, the links inside
it are still pointing to http://localhost/ : obviously, the Android client
then fails to install the forms.

I’ve tracked down the generation of profile.ccpr to
[source]/corehq/apps/app_manager/models.py : Application.create_profile

I wanted to debug this method and inspect the different variables, however it
seems that the content of profile.ccpr is cached somewhere. I have no
experience with django / redis / memcached and I couldn’t find a way to
invalidate the cache.

After setting BASE_ADDRESS in localsettings.py I could delete and re-import my
app : profile.ccpr is then generated with the right domain are I’m able to
upload the forms to Android.

Here are my two questions :

  1. should I fill a bug report for “A change of BASE_ADDRESS is not reflected
    into profile.ccpr” ?

  2. how can I invalide / deactivate the caches ?

Many thanks,

Charles Flèche - TSFI.vcf (286 Bytes)

··· -- Charles Flèche mHealth advisor Télécoms Sans Frontières http://www.tsfi.org Première Urgence - Aide Médicale Internationale http://www.pu-ami.org +95 9 431 978 25 Skype: charles.fleche

Hi Charles,

I’ve deployed CommCareHQ on a local virtual machine so I can build

applications offline. It took a little while to sort that out but now it
seems
to work : I can build applications in CommCareHQ and upload them to my
Android phone offline. So far so good.

Glad you got this sorted out. It’s a use case we’re hoping to one-day
support better so nice to see that it’s possible for new people to setup.

However while setting up the VM I stumbled upon an issue.

First, I’ve followed the doc here

https://confluence.dimagi.com/display/commcarepublic/Transferring+an+Application+Between+Projects+or+Servers
to transfer a prototype application from the official CommCareHQ website
to my
local VM.

Then I followed the doc in [source]/corehq/apps/builds/README.md to install
the relevant CommCare build and set up the site IP address to send the
forms
to Android.

At that point downloading the profile.ccpr file works. However, the links
inside
it are still pointing to http://localhost/ : obviously, the Android client
then fails to install the forms.

I’ve tracked down the generation of profile.ccpr to
[source]/corehq/apps/app_manager/models.py : Application.create_profile

I wanted to debug this method and inspect the different variables, however
it
seems that the content of profile.ccpr is cached somewhere. I have no
experience with django / redis / memcached and I couldn’t find a way to
invalidate the cache.

After setting BASE_ADDRESS in localsettings.py I could delete and
re-import my
app : profile.ccpr is then generated with the right domain are I’m able to
upload the forms to Android.

Here are my two questions :

  1. should I fill a bug report for “A change of BASE_ADDRESS is not
    reflected
    into profile.ccpr” ?

I think that this should get changed the next time you edit your
application settings or make a build. So it is technically a bug but one
that we would severely deprioritize given how rare the use case is
currently.

  1. how can I invalide / deactivate the caches ?

See above. I don’t think this is actually using a cache but saving the file
as an attachment to the app document and then updating it anytime something
changes.

Let us know if that’s not the case though.

Cory

So it is technically a bug but one
that we would severely deprioritize given how rare the use case is
currently.

Fair enough.

See above. I don’t think this is actually using a cache but saving the file
as an attachment to the app document and then updating it anytime something
changes.

So do you know at what point the Application.create_profile is called ? Do I
need to change an application setting to force a recall of
Application.create_profile ?

··· On Sunday 11 May 2014 15:21:19 Cory Zue wrote:


Charles Flèche
mHealth advisor
Télécoms Sans Frontières http://www.tsfi.org
Première Urgence - Aide Médicale Internationale http://www.pu-ami.org
+95 9 431 978 25
Skype: charles.fleche

The profile (and all the other build artefacts) are created when you create
a new application build. The application source is also copied and then
build artefacts are saved as attachments to this app copy.

So what you need to do is create a new application build. In order to do
that you need to make any change to your application and save it (this will
increment the version number and allow you to create a new build).

··· On 12 May 2014 01:54, Charles Flèche wrote:

On Sunday 11 May 2014 15:21:19 Cory Zue wrote:

So it is technically a bug but one
that we would severely deprioritize given how rare the use case is
currently.

Fair enough.

See above. I don’t think this is actually using a cache but saving the
file
as an attachment to the app document and then updating it anytime
something
changes.

So do you know at what point the Application.create_profile is called ? Do
I
need to change an application setting to force a recall of
Application.create_profile ?


Charles Flèche
mHealth advisor
Télécoms Sans Frontières http://www.tsfi.org
Première Urgence - Aide Médicale Internationale http://www.pu-ami.org
+95 9 431 978 25
Skype: charles.fleche


You received this message because you are subscribed to the Google Groups
"CommCare Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Simon Kelly
Senior Engineer | Dimagi South Africa

Ah ok, I get it now. Many thanks Simon and Cory.

··· On Monday 12 May 2014 10:15:42 Simon Kelly wrote: > So what you need to do is create a new application build. In order to do > that you need to make any change to your application and save it (this will > increment the version number and allow you to create a new build).


Charles Flèche
mHealth advisor
Télécoms Sans Frontières http://www.tsfi.org
Première Urgence - Aide Médicale Internationale http://www.pu-ami.org
+95 9 431 978 25
Skype: charles.fleche