Esri / storymap-basic

The Story Map Basic is a simple map viewer with a minimalist user interface.
Apache License 2.0
21 stars 27 forks source link

Unable to run basic map site #5

Closed vishcious closed 8 years ago

vishcious commented 9 years ago

I just downloaded it and tried running it without making any changes at all. I get a "ReferenceError: commonConfig is not defined" which is due to the fact that it is trying to pick up the commonConfig.js file from "http://commonconfig.js/" when i run and access the site as "http://localhost:50524". But if i try to access the same site with the URL "http://localhost:50254/index.html", then it tries to pick up the file from "http://js.arcgis.com/3.13/dojo/templateConfig/commonConfig.js" and resulting in the same error.

vishcious commented 9 years ago

ok. found the error. working on a fix. will update soon

vishcious commented 9 years ago

ok. The dojo package loading doesn't seem to work right when the packages are at the root of the site. If i moved the commonConfig.js file and the "nls" directory into the "javascript" folder and switch their location values to "path_location + 'javascript'", they seem to work alright.

If i host the application under a path like "http://xyz.local/basicmap", then everything seems to work out of the box.

But, if i decide to host the app at just "http://xyz.local" then, there seems to an issue

stdavis commented 9 years ago

Not sure exactly what the problem is, but I took a look at your dojoConfig object and have a few suggestions.

  1. Typically you use baseUrl to define the base folder where all of your packages are and then use relative paths in your individual package definitions.
  2. You have two packages pointing to the same location. I don't think that this is related to this issue but it generally feels wrong to me. :)
  3. Looks like to me that path_location is being set to an empty string when you host the app at the root of your server. You probably want to add a / in this case.

You can check out our typical set up for baseUrl here.

This setup works for us when apps are hosted within a folder (e.g. mapserv.utah.gov/deqenviro) or at the root (e.g. enviro.deq.utah.gov) of the web server.

vishcious commented 9 years ago

i was trying to get the story map project to run. But do have questions,

1 - What does baseUrl default to when not set? So, when hosting at root of site, the baseUrl needs to be "./"? 2 - agreed 3 - path_location does become "/" even when you are at the root. Since, even when your url is "http://xyz.local", your location.pathname is "/" and not ""

thank you for the links. Appreciate it

stdavis commented 9 years ago

Forgive me for leading you astray. I've been spoiled too long by grunt-esri-slurp. I forget how big of a pain it is to load the JSAPI from the CDN with dojo bundled. baseUrl may not be as helpful in this situation.

I believe that baseUrl defaults to the folder that dojo.js is in. Or perhaps it's parent folder. You can check out it's value by looking at require.baseUrl.

You are also right about the path_location variable. It looks like to me you may have to be a little smarter about how you build it. If the current URL is the root of the web server then you may have to add the hostname to the path location.

glazou commented 8 years ago

Sorry about your issue, hope you figured it out. The application has been updated and now supports without any configuration to be deployed in the root folder of a webserver as well as in a folder.