Installing an inherited app to a site

I was given an app that has various modifications/additions to erpnext using hooks.py.

What is the correct way to install this app to a new erpnext site?

I tried moving the app to the apps folder and using the following command:

bench --site [sitename] install-app [application-name]

But bench gives an error that the app does not exist, I assume since the app wasn’t created by it.

So there’s some configuration that needs to be done first for bench to recognize the app. What is the best way to tackle this problem?

You need to register the app first. The standard way to do it is to use the following command

If your app is hosted on git somewhere you can pull it from it’s URL

bench get-app https://git-repo/of/your/app

Otherwise if you have a local copy, make sure it has git setup

bench get-app /home/path/to/your/app
1 Like

Thanks.

If the app is stored in a folder on the same level as the frappe_bench folder what would the correct path to it be? Because when I used the following command:

get-app /<foldercontainer>/<appname>

It seemed to be trying to connect to the web as follows GET repos/epnext//<foldercontainer>/<appname>

Also what do you mean that it should have a git setup?

I read a couple of threads and a workaround seems to be is to set up a github repo with the app and then use get-app with a link to that repo. Is this the only solution? Seems rather strange for there not to be a way to pull from a local folder.

You can pull it from a local folder. Follow these steps:

  1. Put your app outside of frappe-bench directory. For e.g at ~/yourapp
  2. cd ~/yourapp
  3. git init
  4. cd ~/frappe-bench
  5. bench get-app ~/yourapp
bench get-app /home/<redacted>/customizations/<redacted>
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /repos/frappe//home/<redacted>/customizations/<redacted>HTTP/1.1" 404 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /repos/erpnext//home/<redacted>/customizations/<redacted>HTTP/1.1" 404 None
INFO:bench.app:getting app innovaxis
INFO:bench.utils:git clone /home/<redacted>/customizations/<redacted>--depth 1 --origin upstream
Cloning into '<redacted>'...
warning: --depth is ignored in local clones; use file:// instead.
warning: You appear to have cloned an empty repository.
done.
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/gkis/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/gkis/.bench/bench/commands/make.py", line 40, in get_app
    get_app(git_url, branch=branch)
  File "/home/gkis/.bench/bench/app.py", line 128, in get_app
    with open(app_path, 'rb') as f:
IOError: [Errno 2] No such file or directory: u'./apps/<redacted>/setup.py'

Still doesn’t seem to work, this is the error I get. Notice how it does a GET request at /repos/erpnext/ which tells me that it doesn’t recognize local paths, well not in the form I wrote it anyway.

In any case I used the workaround of creating a private github repo for the app and pulling the app from there. I don’t have time to dwell but if there’s a local solution it would be nice to know for the future but also for the community to benefit.

1 Like