Re: Running pgadmin4 as desktop application

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Devrim Gündüz <devrim(at)gunduz(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Running pgadmin4 as desktop application
Date: 2016-10-06 12:42:16
Message-ID: CA+OCxoyr1K1HKHgddVf-heHyDpbzfk_yWQaUki72sATqsFBhNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi

On Thu, Oct 6, 2016 at 11:25 AM, Devrim Gündüz <devrim(at)gunduz(dot)org> wrote:
>
> Hi,
>
> Can you please clarify how to start pgadmin4 in desktop application mode? I
> read
>
> https://www.pgadmin.org/docs4/dev/desktop_deployment.html
>
> but when I run
>
> /usr/pgadmin4-1.0/runtime/pgAdmin4 (installed via community RPMs), I get:
>
> "
> An error occurred initialising the application server:
> Failed to locate pgAdmin4.py, terminating server thread."
>
> (as reported 2 days ago on the list), followed by a segfault. There is an ini
> file at the same directory, with contents like this:
>
> $ cat /usr/pgadmin4-1.0/runtime/pgAdmin4.ini
>
> [General]
> ApplicationPath=/usr/lib/python3.5/site-packages/pgadmin4-web
> PythonPath=
>
>
> Can you please give me a clue so that I can fix the packaging?

The global config file that Qt will read by default seems to be
"/etc/pgAdmin Development Team/pgAdmin 4.conf".

I may change that for 1.1 to use a less obnoxious path. The contents
of it seem to need to be:

[General]
ApplicationPath=../../../../usr/lib/python2.7/site-packages/pgadmin4-web/
PythonPath="/usr/lib64/python2.7/site-packages/;/usr/lib/python2.7/site-packages/"

The ApplicationPath is the directory containing pgAdmin4.py. Due to a
bugette in the way the runtime works, it needs to be relative to the
location of the runtime, hence all the back-tracking. The PythonPath
needs to include both the 32 and 64 bit directories, as it seems that
some of the Python modules end up in each.

That was enough to get it to start for me.

Then, we run into the tricky issues, where you may have to deal with
conflicts between web and desktop mode. In our other installers, we
ship a blank config_local.py file, with a simple comment at the top
telling the user they can customise any settings in that file. For web
users, we don't want that, as it's used as a security mechanism
(startup will fail if it's not present, and tell the user they must
set some security-critical options). Those options don't matter in
desktop mode, hence why we pre-write the file.

Perhaps the way around that is to have the shortcut on the menu call a
script that can create config_local.py if needed? Though, I see you
already have config_distro.py forcing the user into desktop mode,
which is a potential conflict.

The other issue I see is with the docs:

1) The path in config_distro.py is
/usr/share/doc/pgadmin4-docs/en_US/html/. That directory doesn't exist
- if the docs are compiled in-situ, they'll end up in
/usr/share/doc/pgadmin4-docs/en_US/html/_build/html

2) The docs aren't built, so there is no _build/html directory.

3) The docs are integrated into the application so really should be a
dependency of the pgadmin4 RPM.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Surinder Kumar 2016-10-07 06:03:26 [pgAdmin4][Patch]: RM1739 - Don't show Upload File icon unless it is not in capabilities [Storage Manager]
Previous Message Devrim Gündüz 2016-10-06 10:25:06 Running pgadmin4 as desktop application