Ember guides todomvc tutorial - ember.js

I am following the tutorial in the Ember guides simply copy/pasting code. When I reach this part of the tutorial I get errors on reloading the page including:
Failed to load resource file:///home/kwal0203/ember_development/ember_tutorial/js/libs/jquery.min.js
Failed to load resource file:///home/kwal0203/ember_development/ember_tutorial/js/libs/handlebars.js
Assertion failed: Ember Views require jQuery 1.7, 1.8, 1.9, 1.10, or 2.0 ember.js:394
Assertion failed: Ember Handlebars requires Handlebars version 1.0.0. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember. ember.js:394
Uncaught TypeError: Cannot read property 'COMPILER_REVISION' of undefined ember.js:23618
Uncaught TypeError: Cannot call method 'map' of undefined
Any help appreciated

It's almost clear why your app is not working, you are loading it using the file:// protocol. This makes your vital js files to not load at all resulting in the errors you get.
Failed to load resource file:///home/kwal0203/ember_development/ember_tutorial/js/libs/jquery.min.js
...
The simple solution to your problem is to serve all the app related files from the http:// protocol, this can be easy achieved using a simple webserver. If setting up a webserver is out of your scope then use a online editor like http://jsbin.com instead and load the js libraries from a CDN, then copy and paste all your code in the online editor and everything should work correctly.
If you have python installed on your system, another possibility to have your files served by a webserver could be the following:
$ cd /home/kwal0203/ember_development/ember_tutorial/
$ python -m SimpleHTTPServer
Now open your browser and visit: http://localhost:8000
Hope it helps.

Related

Use sphinx with Flask and preserve formatting

I generate some Python documentation with Sphinx. If I go to the build/html directory and open index.html directly, I get Sphinx formatting.
If I try to serve the same page Flask with the following code, I get the page but all the Sphinx formatting is gone:
from flask import send_from_directory
#app.route('/help')
def help():
return send_from_directory('/sphinx/build/html', 'index.html')
I am calling Flask directly with app.run in debug mode. This is how I like it. I know how to set it up in Apache but I don't want to run Apache. Is it possible to serve Sphinx inside Flask and still get the formatting, or do I absolutely have to run a web serve like Apache?
Copy your Sphinx documentation folder with generated html files /sphinx/build under the static folder ./static/sphinx/build.
Then use Jinja to link it:
Documentation
The resulting url on your local server will look similar to this:
http://127.0.0.1:5000/static/sphinx/build/html/index.html
When your app is deployed, replace the new directory with a symbolic link, so needn't copy the /sphinx/build folder every time the documentation is built.

Using signalR in Ionic 2

In angular I can use signalR, one of the requirements is to include the following script in index.html
<script src="signalr/hubs"></script>
In ionic 2, I get the following error:
Failed to load resource: net::ERR_FILE_NOT_FOUND
How do I use this with ionic 2?
Using full url seems to do the trick.
Don't use script tags in webpack builds. The location changes and the files is not found.
For signalR in ionic I suggest you use this module
https://www.npmjs.com/package/signalr-no-jquery

Google App Engine - This app has no instances deployed

App Instances:
App Versions:
app.yaml:
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /my_uri
script: path.to.my.script.script.app
I created a Python Flask app with Google App Engine. I initially ran into some issues, so I re-deployed the app. This created a new version. After doing so, I deleted the previously existing version which had one instance deployed. The currently deployed version has no instances deployed, as you can see in the image at the link above.
When I submit a request to my-app-ID.appspot.com/my_uri, I get a 404 error:
Error: Not Found
The requested URL /my_uri was not found on this server.
I believe this is related to my app not having an instance deployed. Is that correct? If so, how would I remedy this?
If not, what could be causing the 404 issue?
Thanks everyone!
As your error message indicates gcloud app browse makes a request for the / url to your app.
From Request handlers:
When App Engine receives a web request for your application, it calls
the handler script that corresponds to the URL, as described in the
application's [app.yaml][2] configuration file . The Python 2.7
runtime supports the WSGI standard and the CGI standard for
backwards compatibility. WSGI is preferred, and some features of
Python 2.7 do not work without it. The configuration of your
application's script handlers determines whether a request is
handled using WSGI or CGI.
But your app.yaml file does not contain a handler with a matching url pattern (as / doesn't match /my_uri), so GAE doesn't know which app script to launch for that request, so it'll return 404.
So the first thing you have to do is to add in app.yaml a handler with a url pattern that matches a / request.
You may want to go through the Getting Started with Flask on App Engine Standard Environment guide. In there the recommended handler would be:
handlers:
- url: /.*
script: main.app
The above alone won't necessarily make your app work, there's plenty of other things that can go wrong. You should get familiar with the app's log viewer as that's essential for debugging your app. See Understanding request log fields
But before you even go to deployment on GAE, learn how to run and test your app locally. See Using the Local Development Server

Incorrect MIME type from nginx serving Mezzanine and Django-compressor minified javascript

I've deployed Mezzanine to an EC2 Ubuntu instance and am serving static assets locally with a default nginx configuration. When logged into Mezzanine the inline editing js doesn't load properly from the minified js in the static/CACHE created by compressor.
(If I turn off compressor, everything works fine)
errors: (truncated for brevity)
Resource interpreted as Script but transferred with MIME type text/html: "http://ec2-54-187-111-135.us-west-2.compute.amazonaws.com/about//plugins/inlinepopups/editor_plugin.js/". 6ec516b360b5.js:616
Uncaught SyntaxError: Unexpected token < ec2-54-187-111-135.us-west-2.compute.amazonaws.com/:1
Resource interpreted as Script but transferred with MIME type text/html: "http://ec2-54-187-111-135.us-west-2.compute.amazonaws.com/about//langs/en.js/". 6ec516b360b5.js:616
I understand the problem as being essentially the same as this question but I'm not sure how to explicitly configure nginx to set the MIME type correctly for assets loaded from within Mezzanine's minified admin js in the compressor created CACHE ?
I'm not sure what more info to post relevant to my config - will edit post in response to comments
Could you post your Main Nginx conf and your mime.types? Also probably a good idea to post your App specific conf as well.
Be sure to sanitize as required.
#example
sudo cat /etc/nginx/mime.types
sudo cat /etc/nginx/nginx.conf

Django css not rendering from amazon server- 304 not modified

I am using a amazon server to host my Django app. It used to work fine but after some changes in the css files the app is not rendering those files anymore. I ran python manage.py collectstatic. Through firebug I can see the css files through up the error 304 not modified.
I guess this post address the issue but I couldnt understand it! What should I do to make so that static files render properly?
It is good practice to use something like /path/to/style.css?ver=CURRENT_VERSION to ensure that all users get recent version of CSS, JS and other static. CURRENT_VERSION could even be auto-populated from current Git commit id on deploy.