FAQ Database Discussion Community


Loading an arbitrary file in the Play Framework 2 (Scala)

angularjs,scala,playframework,playframework-2.0,static-files
I'm trying to serve an AngularJS application using the Play 2 Framework for Scala and I think I understand, in general, how the routes and the templates work. In order to serve the angularJS files (which should NOT be available for users publicly), I'm currently placing them under /public and...

Django template in static directory?

django,static-files
It is a good practice to put my django templates in my static directory? The collectstatic would copy all my template files in the static directory anyway. Why not putting the static files in the static dir directly?...

nginx static images fallback

nginx,static-files,fallback
i use nginx 1.6.2 to serve static images from a folder. I need to serve the requested file if exists or fallback to a default image. i had this location block location /test/img/ { rewrite ^/test/img/(.*) /$1 break; root /path/to/folder/images; try_files $uri /default.jpg; } The "/path/to/folder/images" folder contains 2 files:...

`express.static()` keeps routing my files from the route

node.js,express,static-files
While working on an express project, I am trying to use an express.Router object to handle my application routes. In my main app file, I have added a static route for all my static files(css, javascript, html). app.js var express = require('express'); var io = require('socket.io')(app); var bodyParser = require('body-parser');...

Local files with relative paths are not loading in NodeJS Express app

node.js,express,static-files
I'm trying to build an app in Express and Node.js. My server files are contained in the app folder and the frontend stuff is in the public folder. My file structure is like: my_project |- app | |-(server stuff) | |- .... |- public | |- modules | | |-...

How does the root of a Go web application get resolved?

web,go,relative-path,static-files
Im using go's net/http library to serve up a web app. When users come to the site, they can simply go to /, and it serves index.html (like any site). This is implemented using: r.PathPrefix("/").Handler(http.FileServer(http.Dir("./"))) However, there are two ways to structure such an app. First you could pack all...

Django stylesheet will not load

python,django,stylesheet,static-files
I have read through the limitless threads on static files and all the issues that seem to occur, but nothing fixes my issue. I spent a lot of time getting my "media" folder working yesterday, but I cannot seem to get the static files working. My template looks in the...

Deploying Golang web app static files with Docker container

deployment,go,docker,static-files
I'm working on a small web application that has some static files (configs and html templates): ├── Dockerfile ├── manifest.json ├── session │   ├── config.go │   ├── handlers.go │   └── restapi_client.go ├── templates │   ├── header.tmpl │   └── index.tmpl └── webserver.go For instance, templates in the code are discovered with...

How to point Flask static to Amazon S3 URLs?

heroku,flask,static-files
I have a Flask app hosted on Heroku but want the static files to be served from Amazon S3. In my templates I use url_for() for all references to static files. In the initialization of the Flask app I then want to put app = Flask(__name__, static_url_path="http://my-bucket.s3.amazonaws.com") to make sure...