I have the following site structure:
mysite.com
/app1/
/app2/
Right now with my configuration it seems when I navigate to mysite.com, it shows a list of the apps on the server.
How can I get it to show app1/index.html when i navigate mysite.com?
Ok... not sure why it took me this long to find the answer but... according to some page online which I now forget...
Rename app1 folder to 'root'. The default handler defined in your jettyweb config xml will then map this app to /
You can also throw in a WEB-INF folder and web.xml to define things like the default welcome page, so you don't have to type mysite.com/index.html
That's right. You can configure one of your webapps to map to "/" by defining a context for it.
Here's the documentation:
jetty9 - http://www.eclipse.org/jetty/documentation/current/setting-context-path-to-root.html
jetty7/8 - http://wiki.eclipse.org/Jetty/Howto/SetContextPathto_/
If you simply want to disable that list of webapps mapping on the root context "/", then have a look at jetty_home/etc/webdefault.xml and the according sections in the documentation.
Hope that helps.
Related
I am planning to convert a django project to Progressive Web App. I am not being able to figure out where to put the service_worker.js and manifest.json files in my django project. I've tried the following:
myproject/
|__app1
|__app2
|__manage.py
|__manifest.json
|__service_worker.js
and then tried to register the service worker from html file using relative path ../../../service_worker.js. That didn't work. It showed this error: "A bad HTTP response code (404) was received when fetching the script."
Another approach I tried is to put the service_worker.js and manifest.json in the static folders:
myproject/
|__app1/
|__static/
|__app1/
|__service_worker.js
|__manifest.json
|__app2
|__manage.py
and access those using {% static 'app1/service_worker.js' %}. The problem with this approach is that the scope of the registered service_worker.js becomes limited to that static folder. I've seen in one stackoverflow answer that I can explicitly set the scope of the service worker as {scope: '/'}. But, I think there might be a better approach which I am missing. Please let me know if anyone has a solution to this.
Looks like you want to have a common SW for all your app(1, 2). You can have both SW and manifest.json at the project root, link the manifest to your project's home page. If you want to cache the whole path, setting scope is not a bad idea, as the same has been officially documented here.
Look for "Registering your worker" part in the linked page.
Service Worker needs to be served from the same path it will handle so if you put after static,.it will handle only static/ so to put under '/' you have to create a view that returns the Service worker js.
def sw(request):
return HttpResponse(settings.SERVICE_WORKER)
Note: you can use django template to generate the final js
For Manifest, it is a usual static file.
In my sitecore instance, (8.2 rev 170407), I'm having an issue viewing the homepage in both my dev enviroment and my staging server. Going to the homepage (the root of the server) redirects to this URL
http://[website]/sitecore/service/nolayout.aspx?item=%2f&layout=%7b00000000-0000-0000-0000-000000000000%7d&device=Default
The message says:
The resource you are looking for (or one of its dependencies) may have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Additional Information:
Requested URL: /
Requested Layout: {00000000-0000-0000-0000-000000000000}
Requested Device: Default
In testing this, I set the Home item to have an alias of /home, which I can visit and see the page looking fine.
This issue began when I set up Helix via the Yeoman script, and built it in VS2015. This is my first Sitecore Site so I handily accept that I made a mistake -- for example when I built the Solution for the first time it overwrote my Web.config. I had a backup of that Web.config and was able to bring the site back online but the Homepage has eluded me.
I've published, and republished. In my naive experience, I find it odd I can see the homepage at /home but not /. Any advice is appreciated, thanks.
Based on my understanding WebStorm has the concept of context Root ( basically the root of your project for source purposes) and Resource Roots folder(s) from which web requests can be resolved relative to.
I've got a project structure like
Projects (Context Root)
|
MyProject (ResourceRoot)
|--- html
|----css
|----images
I'd like to access my html files like so http://localhost:34343/html/index.html
however that's not possible. The only way I can access files is when the 'Projects' context root forms part of my url. e.g http://localhost:34343/Projects/html/index.html
(note that the resourceroot seems to be working to some extent as a I can omit the 'MyProject' part of the path.
I've got some css with absolute references that want to access /images which break when the context root has to be included. As far as I can tell moving the Context root 'down' a level isn't going to help as it will require 'MyProject' on the path.
I'm guessing I can probably force it to use something like apache where I can get more control of url resolution, but Ideally I'd use the built in server from the IDE.
http://localhost:63342/html/index.html -- you cannot have this kind of URL with built-in web server .. as IDE does not know what project to serve (as it works for ALL your projects a not only currently opened).
When built-in web server is in use, the URL has to have some hint (PROJECT_NAME) that would tell what project to serve (where to take files from).
Built-in web server supports 2 kind of URLs (both of them will serve the same file):
http://localhost:63342/PROJECT_NAME/index.html
http://PROJECT_NAME:63342/index.html
If you happy with 2nd URL, then you will have to do these steps:
Create Deployment entry (Settings/Preferences | Build, Execution, Deployment | Deployment) and mark it as Default for this project. The URL defined there (http://PROJECT_NAME:63342/) will be used when opening pages from within IDE.
This is required if you want to use Open in Browser functionality, otherwise you may safely skip it.
In your hosts file (or your local DNS server, if you have one) define an entry that would point PROJECT_NAME to your IP. For example (for hosts file): 127.0.0.1 PROJECT_NAME.
We have a multisite SiteCore setup with 2 sites within the same .Net solution.
This works by setting the rootPath property on a Site Definition in web.config to limit the site to part of the SiteCore folder structure.
This works well apart from when pages are created with the same name as in the other site then it's serving content from the other site! We have inherited a fair bit of custom code in this solution form the other site so this may be the cause but dont know what Im looking for ...
Thanks
How are you referencing the sites? Do they each have their own host name? Do you have the "hostName" property set for the site node in the Site Defintion?
I will assume that you are not referring to them this way and instead, the sites are using the "virtualFolder" property. If both sites have the same default value of "/" for virtualFolder, attempting to get to either site will result in Sitecore rendering the first site that it matches on, which would be the site listed first.
Try putting the actual site name for "virtualFolder" and "physicalFolder" (e.g. "Site1" and "Site2", respectively). Then you can address your sites as http://yourserver.com/Site1 and http://yourserver.com/Site2. The "virtualFolder" will match first and render the correct site.
See Configuring Sites in the web.config File on SDN for additional information.
Hope this helps.
It turns out this is happening in this case because of a System alias that is redirecting for a subset of pages
I finally got my django install working, however I'm noticing that the typical look and feel of the admin pages are missing, and it's as if there are no styles applied to the structure of the pages. Do I have some kind of setup issue or pathing issue that's preventing the style sheets from being found? Where are they stored? My pages look like they are from 1994.
Sounds like your admin media isn't being served correctly. In your settings.py, there's a variable called ADMIN_MEDIA_PREFIX, which specifies the URL where Django should look for them. The actual media files are in "[path to your Python site-packages]/django/contrib/admin/media". When using manage.py runserver, the files are served "automagically". However, when using Apache/nginx/etc it's your responsibility to make sure that your server makes the files available at that URL (using rewrite rules, symlinks, etc). More info can be found here.
I've solved this issue simply with the alias on apache:
Alias /static/admin/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/
Alias admin/media/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/
You need to provide more info for use to help you properly. However, this is most probably because didn't set up your Web server to serve static file, and therefor, the admin CSS is not loaded.
To solve this, got the the admin and look at the HTML source. You'll css the path to the admind css. Make your web server service this file on this path.