static-files

Loop through all files/images in a folder with Angular

房东的猫 提交于 2019-12-01 04:29:44
问题 I have an app with some products and each product has a gallery with a different amount of images. Each of the images has a name that is completely random / no correlation with the other image names. Each of the product images are in /src/assets/images/products/:id/ . I need to add the paths to a gallery component but I can't loop through them because the names are random. Is there any way to just loop through each file from a folder using only Angular? If not can I do it on the back-end

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

匆匆过客 提交于 2019-11-30 18:37:46
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'); var router = require('./include/router'); var app = express(); app.use('/', router); app.use(express.static(__dirname + '/public')); app.use(bodyParser.json()); io.on('connection', function(socket) { }); app.listen(3000); router.js var express = require('express'); var

Flask static file Cache-Control

旧城冷巷雨未停 提交于 2019-11-30 17:16:20
I'm trying to set a reasonable cache expiry for my JS files while in development. I have the standard setup, where HTML, CSS and JS are living under the static directory. The docs do mention this, but for the life of me I cannot get this to work. I've tried both methods implied, first class MyFlask(flask.Flask): def get_send_file_max_age(self, name): if name.lower().endswith('.js'): return 60 return flask.Flask.get_send_file_max_age(self, name) app = MyFlask(__name__) and app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 60 Both have had no effect, my JS files under /static are still coming back with

Node/Express - Refused to apply style because its MIME type ('text/html')

北城以北 提交于 2019-11-30 08:56:06
I've been having this issue for the past couple of days and can't seem to get to the bottom of this. We doing a very basic node/express app, and are trying to serve our static files using something like this: app.use(express.static(path.join(__dirname, "static"))); This does what I expect it to for the most part. We have a few folders in our static folder for our css and javascript. We're trying to load our css into our EJS view using this static path: <link rel="stylesheet" type="text/css" href="/css/style.css"> When we hit our route / , we're getting all of the content but our CSS is not

Static files won't load when out of debug in Django

ぃ、小莉子 提交于 2019-11-30 06:25:08
问题 I'm creating a Django project. I just tried taking the project out of debug, DEBUG = False and for some reason all my static files do not show up. They give an error code of 500. How do i fix this? some of settings.py: DEBUG = True TEMPLATE_DEBUG = DEBUG ... TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django

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

半城伤御伤魂 提交于 2019-11-30 02:49:55
问题 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'); var router = require('./include/router'); var app = express(); app.use('/', router); app.use(express.static(__dirname + '/public')); app.use(bodyParser.json()); io.on(

Flask static file Cache-Control

我的未来我决定 提交于 2019-11-30 00:42:36
问题 I'm trying to set a reasonable cache expiry for my JS files while in development. I have the standard setup, where HTML, CSS and JS are living under the static directory. The docs do mention this, but for the life of me I cannot get this to work. I've tried both methods implied, first class MyFlask(flask.Flask): def get_send_file_max_age(self, name): if name.lower().endswith('.js'): return 60 return flask.Flask.get_send_file_max_age(self, name) app = MyFlask(__name__) and app.config['SEND

With Flask, how can I serve robots.txt and sitemap.xml as static files? [duplicate]

拥有回忆 提交于 2019-11-29 23:01:09
This question already has an answer here: Static files in Flask - robot.txt, sitemap.xml (mod_wsgi) 9 answers I've read on quiet a few places that serving static files should be left to the server, for example in a couple of the answers on this SO question . But I use the OpenShift PaaS, and can't figure out how to modify the .htaccess file there. I came across this piece of code that serves the sitemap from a template. I did that on my app for both the sitemap, and robots.txt, like so - @app.route("/sitemap.xml") def sitemap_xml(): response= make_response(render_template("sitemap.xml"))

How can I handle static files with Python webapp2 in Heroku?

一笑奈何 提交于 2019-11-29 14:19:07
I am now migrating my small Google App Engine app to Heroku platform. I don't actually use Bigtable, and webapp2 reduces my migration costs a lot. Now I'm stuck on handling the static files. Is there any good practices? If so, lead me there please. Thanks in advance. EDIT Well, I'm now using paste for my WSGI server. And paste.StaticURLParser() should be what I need to implement static file handler. However I have no idea how to integrate it with webapp2.WSGIApplication() . Could anyone help me? Maybe I need to override webapp2.RequestHandler class to load paste.StaticURLParser() properly;

Node/Express - Refused to apply style because its MIME type ('text/html')

安稳与你 提交于 2019-11-29 12:24:40
问题 I've been having this issue for the past couple of days and can't seem to get to the bottom of this. We doing a very basic node/express app, and are trying to serve our static files using something like this: app.use(express.static(path.join(__dirname, "static"))); This does what I expect it to for the most part. We have a few folders in our static folder for our css and javascript. We're trying to load our css into our EJS view using this static path: <link rel="stylesheet" type="text/css"