I am creating one ember app. The app is working fine while running on development server (using ember serve), but when i build my app using ember build -prod and deploy it on my server which is apache, just index route works and nothing else.
This is understandable as only index path is physical but i am not finding any way to get this done.
Is there any documentation on build process which can enable all routes?
This is not something EmberJS can fix through the build process. You need to change your server's configuration.
Apache's mod_dir has a "Fallback resource" directive you need to activate for your website since the JavaScript router URLs are not pointing to actual files or folders.
Add this directive in the VirtualHost entry:
FallbackResource /index.html
See this related answer
Related
I've got an app I've built locally and I'm ready to deploy it but using Vue as a frontend and Django as the backend is something new to me. My current folder structure looks like:
-Backend
-Frontend
-Env
The backend folder is a traditional Django project with sqlite as a DB and frontend is your normal looking Vue project while env is the virtual environment
I don't even know how to go about this or what questions to ask but I've come to see that people deploy SPAs with AWS Elastic Beanstalk.
What is the most straightforward way to deploy an app like this?
The best way we often use
If you are accessing your Django project using ajax call
1.Create the build of your project
Once your build is created you need to host this build to some URL using s3 or any other preferred static hosting.
Now you need to deploy your Django project using EB, once you deploy your project you will get an autogenerated URL
In your frontend project, you need to set an environment variable in your configuration so that whenever you build a project all you ajax call will be redirected to the elastic beanstalk auto-generated URL and whenever you are working locally all your call will be redirected to the localhost URL
Below coded is not the exact just a rough idea of what exactly your baseurl should look like
env.APILINK=env.build? 'beanstalkurl':'localhost'
Make sure you add a base URL to you axios or any other ajax call,
once you set your baseurl based on the environment you are working, all the ajax call will be redirected accordingly
For the dev environment
http://localhost/api/getsomedata
For the prod environment which is actually a build
http://beanstalkurl/api/getsomedata
I deployed a React-Application with the Staticfile Buildpack to Cloudfoundry on the SAP Cloud Platform which has different routes (e.g."/login", etc.)
When I access the app with the provided URL (e.g. "www.exampleurl.com") and navigate through my app everything works, the different pages with different routes are working as expected.
My problem now is that, everytime I want to reload a page or if I want to access the application with an additional path attached initally e.g "www.exampleurl.com/todo-route" instead of just "www.exampleurl.com/" I get an 404 Not Found nginx error.
Is this problem related to the application router I need to configure before deploying my application or is it something different.
Unfortunately, I am not getting smarter from reading the documentation and resources on this are very rare in general.
I would appreciate some advice very much. Thank you in advance.
For people having trouble with single-page applications as well:
I found an answer already myself.
Refering to this post:
Deploy single page application Angular: 404 Not Found nginx
You need to add a "Staticfile" file in your dist or build folder with "pushstate: enabled".
You can also refer to the cloudfoundry documentation for the staticfile buildpack: https://docs.cloudfoundry.org/buildpacks/staticfile/index.html
Hope that will help some people on the way.
I'm using a deployed github repo project as a starting point for my own development project. Using ember-cli and ember serve I get a server running on localhost:4200. But it says
Proxying to https://xxxxx.yyy
where xxxxx.yyy is the website of the official deployed project, and the localhost:4200 server interacts with the deployed project's databases.
How do I tell ember to start a completely new local server that creates local empty databases, instead of proxying to the deployed website?
I tried ember build --environment=development, and it rebuilt, but it acts the same.
It sounds like you have a proxy configured in the .ember-cli file, as described in the guides. If you remove that property, Ember CLI should no longer use a proxy.
I've built a gatsby website, but when I try to use it offline (by directly loading index.html into my browser), it fails to load the files in the assets folder, and links to other pages fails
running in windows:
after installing gatsby , I did the following:
gatsby new sample
cd sample
gatsby build
then I went to file explorer and opened the sample/dist directory and double clicked on index.html (Chrome is my default browser, but IE behaves the same)
the result is a half-loaded webpage that is missing the style sheets, javascript, images, and links are broken.
For instance, the "about" link on the first page points to "D:/about" vs. ".\about.html".
Is there anyway to make gatsby work to create a truly off-line website?
I've built a gatsby website, but when I try to use it offline (by directly loading index.html into my browser), it fails to load the files in the assets folder, and links to other pages fails
Gatsby will create a React app for you when it is built, and because most React apps use client-side routing, your links won't work with file:// URLs.
After installing the Gatsby CLI and building your site with gatsby build you should run gatsby serve which will serve up index.html with a static file server on your own machine.
See a similar answer about create-react-app here
Try using gatsby serve from the root of your project. Serve spins up a web server to serve your prod build.
Look it up on the Gatsby CLI docs on their site.
Gatsby isn't really set up to do that, unfortunately. It's a site generator, not page generator, and it expects living on a server. The result is that while the files are static, the navigation isn't.
Because I spent some time experimenting, this is what DOESN'T work:
Setting . as pathPrefix in gatsby-config.js. Gatsby lets you set path prefix, which it then prepends to all generated urls. Unfortunately, this prefix always gets "absolutized" somehow. . gets converted to /., for example.
Setting the absolute path of the file on disk as pathPrefix. Same as above - file:///path/to/file doesn't survive the build (results in file:/) and /path/to/file breaks the JavaScript.
Setting the pathPrefix to a bogus value like /NOTAPREFIX and search-replacing it in the generated files. Breaks the JavaScript, again.
Something I haven't tried but might get you somewhere, would be to disable the Single Page App functionality. It's possible, reportedly, (or maybe with this plugin?) but no good step-by-step instructions anywhere.
I have deployed my application on subdomain.domain.com (it works only on that one subdomain). Everything works fine except the fact that from time to time users cannot log in to application (the message "Looks like your browser isn't configured to accept cookies. Please enable cookies, reload this page, and try again" is shown when trying to log into admin panel). I've noticed that restarting the web server eliminates this problem for some time.
Does anyone have experience with setting up django project on subdomain and can guide me how to configure my application to make it work correctly without need to ocasionally make reset?
I'd tried to set up SESSION_COOKIE_DOMAIN = 'subdomain.domain.com' setting but it didn't solve the problem (maybe I set it wrong?)
I use Django 1.1.1, Python 2.5.4 for this project. Project is deployed in provider I use for other projects and cookies works there perfectly. Other projects run also on subdomains and do not have SESSION_COOKIE_DOMAIN set at all.
in your settings do you have SESSION_COOKIE_DOMAIN set? If so, is it set to something that isn't the domain the site is operating on?