spdx / spdx-online-tools

Source for the website providing online SPDX tools
https://tools.spdx.org
Apache License 2.0
60 stars 57 forks source link

Check license no longer works #511

Closed goneall closed 10 months ago

goneall commented 1 year ago

After the upgrade, when submitting a new license - if you click on check license, nothing happens.

The browser console log has the following error:

(index):896 Uncaught ReferenceError: findLicenseMatch is not defined
    at HTMLButtonElement.<anonymous> ((index):896:5)
goneall commented 1 year ago

@BassCoder2808 @rtgdk - could you take a look at this

BassCoder2808 commented 10 months ago

Hi @goneall, I checked this and have attached the SS below, it is working on my local machine, does the issue still persist? because the

findLicenseMatch function is present in the utils.js which is loaded on line 177 in submit_new_license.html

image

goneall commented 10 months ago

@BassCoder2808 I just checked the deployed system at https://tools.spdx.org/app/submit_new_license/ and the error is still there.

It looks like the function is defined in the file static/js/util.js but that file is not present on the deployed system - see below.

Is it possible there is some deployment issue where that file isn't being deployed?

image

BassCoder2808 commented 10 months ago

I think the problem is that we are not running the collect static command and the STATIC_ROOT URL is not defined

Static File Configuration: In your Django settings, ensure that the STATIC_ROOT and STATIC_URL are correctly configured for production. STATIC_ROOT should point to where your static files are collected for deployment.

Collect Static Files: Run python manage.py collectstatic to gather all static files from your apps into one location. Ensure this command is run before deploying your Django app.

Web Server Configuration: Check if your web server (like Nginx or Apache) is correctly configured to serve static files. It should be configured to serve files from the STATIC_ROOT directory.

Permissions: Verify that the user running the web server process has permissions to access the static files in the deployed directory.

Debug Mode: If Django is in debug mode (DEBUG = True), static files might be served by Django itself, which could differ from how they are served in production. Ensure DEBUG is set to False in the production environment.

Cache Busting: Check if there's any caching mechanism interfering with the visibility of the updated static files. Clearing the cache or using cache-busting techniques might resolve the issue.

Deployment Scripts: Review your deployment scripts to ensure they are correctly copying static files to the appropriate location in your production environment.

BassCoder2808 commented 10 months ago

I will create a PR fo this and @goneall you can check then and we can proceed further

goneall commented 10 months ago

Thanks @BassCoder2808

goneall commented 10 months ago

Fixed with PR #518