Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load the sidebar plugin in production environment #5

Open
1 task done
gisuser0 opened this issue Jul 8, 2024 · 2 comments
Open
1 task done

Unable to load the sidebar plugin in production environment #5

gisuser0 opened this issue Jul 8, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@gisuser0
Copy link

gisuser0 commented Jul 8, 2024

Checklist

  • I've searched through the existing issues and this bug has never been reported before

Subject of the issue

I followed these instructions:

https://github.com/g3w-suite/g3w-client?tab=readme-ov-file#project-setup

to develop the client and I followed these instructions:

https://github.com/g3w-suite/g3w-client/tree/dev/src/plugins

to add this plugin (sidebar).

I updated the config.js file accordingly:

const G3W_PLUGINS = [
  'sidebar'
];

I changed base(); with base(this); in the service.js file (to avoid js error) and I run the cmd:

npm run dev

The plugin works and the sidebar item is shown in the client GUI (both in localhost:3000 and localhost:8000).

When I try to deploy the plugin in the production environment (g3w-admin) with the command:

npm run build

the following structure is created:

g3w-admin
└── g3w-admin/
    └── sidebar/
        └── static
            └── sidebar
                └── js
                    ├── plugin.js
                    └── source
                        └── plugins
                            └── sidebar
                                └── plugin.js.map

but when I run the client with the command:

paver start

this error appears: No module named 'sidebar.urls'

If I add the file 'sidebar.url' in the folder g3w-admin/sidebar

content: urlpatterns = []

the error disappears but the plugin is not loaded in the GUI.

I added 'sidebar' also in the local_settings.py:

G3WADMIN_LOCAL_MORE_APPS = [
    'editing',
    'caching',
    'filemanager',
    'qplotly',
    'qtimeseries',
    'sidebar',
]

Do I need to edit any other config files to load the plugin in production?

Thanks in advance for any suggestions.

Steps to reproduce

``

Environment

[g3wsdk.info]

  • g3w-admin: 3.8.dev-20240605113156
  • g3w-client: 3.10.0
    • editing: 3.8.0
    • qtimeseries: 3.8.0-alpha.0
  • browser: Chrome 126.0.0.0
  • operating system: Linux 64-bit

Link to your project

No response

Additional info

No response

@gisuser0 gisuser0 added the bug Something isn't working label Jul 8, 2024
@Raruto
Copy link
Collaborator

Raruto commented Jul 8, 2024

Hi @gisuser0,

paver start

I don't use paver for development, but maybe it's just Python cache, have you already tried restarting the server?

https://github.com/g3w-suite/g3w-admin?tab=readme-ov-file#how-to-develop

NB For the future, if you intend to develop a third-party plugin, I also recommend you think about installable pip plugins (so you don't risk "breaking" core code)

https://github.com/g3w-suite/g3w-suite-docker/blob/dev/README_DEV.md#developing-a-python-plugin-pip-install

Through g3w-suite/g3w-admin#746 you can also get an additional idea of ​​how to develop a custom plugin.js in such way (using much modern code).

Sorry for the inconvenience, but we are in a fairly heavy refactoring process.

👋 Raruto

@Raruto
Copy link
Collaborator

Raruto commented Jul 26, 2024

@gisuser0 were you able to solve it?

Feel free to send some PRs to improve/fix existing code/docs.

👋 Raruto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants