Questions tagged [static-files]

Static-files are ones that don't get amended during runtime. This could be a HTML file that's served up by a web server.

769 questions
29
votes
9 answers

ImproperlyConfigured at / Empty static prefix not permitted - Django

I'm working on uploading/displaying images with Django. The website is deployed on Heroku. Following this tutorial I was able to successfully upload images. However, the images weren't being displayed in the template. I then learned that my urls.py…
Daniel Scott
  • 1,867
  • 3
  • 13
  • 18
29
votes
2 answers

What is the best practice for serving html in node.js with express.js?

I currently am serving all my html right in my app.js/server.js file like this: app.get('/', function(req, res) { res.render('index.html'); }); app.get('/about', function(req, res) { res.render('about.html'); }); app.get('/projects',…
user2336703
28
votes
7 answers

Start an apache server in any directory from command line

I want to be able to start an apache server from the command line, typing something like apache site-folder or apache . --port=2000 This should read and use .htaccess files. I know about python -m SimpleHTTPServer and it's close to what I need, but…
28
votes
2 answers

Disable static file caching in Tornado

By default, Tornado puts a Cache-Control: public header on any file served by a StaticFileHandler. How can this be changed to Cache-Control: no-cache?
Jordan
  • 4,510
  • 7
  • 34
  • 42
24
votes
5 answers

How to serve static HTML files in Nest.js?

I want to serve static HTML files which are in a /dist folder outside of the Nest project. index.html is loaded successfully but it fails to load any JS file (404 error). I have a Node/Express.js project which uses app.use('/',…
Maurice Wipf
  • 647
  • 2
  • 7
  • 13
24
votes
4 answers

Connection reset by peer when using s3, boto, django-storage for static files

I'm trying to switch to use amazon s3 to host our static files for our django project. I am using django, boto, django-storage and django-compressor. When I run collect static on my dev server, I get the error socket.error: [Errno 104] Connection…
jkeesh
  • 3,289
  • 3
  • 29
  • 42
22
votes
2 answers

Django runserver not serving static files in development

I am using Django with runserver for my development. When I deploy to my production server I can see all my static files, but not on my local computer. I did collectstatic and I have set DEBUG = True. I found many different opinions online, the most…
Meir
  • 1,943
  • 5
  • 22
  • 38
22
votes
2 answers

Flask static file Cache-Control

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.…
markdsievers
  • 7,151
  • 11
  • 51
  • 83
21
votes
5 answers

How to serve static files in FastAPI

I am trying to serve static files that I have in a package_docs directory. When I open in the browzer: http://127.0.0.1:8001/packages/docs/index.html , the page is running. But I want to open the page: http://127.0.0.1:8001/packages/docs/ without…
Christy Nakou
  • 393
  • 1
  • 2
  • 14
21
votes
7 answers

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

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…
Matthew
  • 659
  • 1
  • 4
  • 19
20
votes
6 answers

Deploy Nodejs on Heroku fails serving static files located in subfolders

I'm deploying a NodeJs application using Heroku. Everything works fine except a little issue serving static files. I have the following configuration app.use(express.static(__dirname + '/htdocs')); It works fine except when I try to serve static…
ius
  • 1,511
  • 2
  • 15
  • 31
19
votes
4 answers

Is it possible to using Image.getSize with static image file?

I want to use Image.getSize (https://facebook.github.io/react-native/docs/image.html) to get the size of my image but the first argument require the image source to be in URI but I can't use URI with static file, I can only use Require. Therefore,…
binkpitch
  • 677
  • 1
  • 8
  • 18
18
votes
2 answers

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

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 =…
Nachshon Schwartz
  • 15,289
  • 20
  • 59
  • 98
18
votes
2 answers

How to cache static files in ASP.NET Core?

I can't seem to enable caching of static files in ASP.NET Core 2.2. I have the following in my Configure: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); …
Colton Scottie
  • 807
  • 1
  • 8
  • 22
16
votes
2 answers

ASP.NET MVC application gives Internal Server Error only when viewed in Firefox

(I'm new to .Net and the Microsoft world in general, coming from a Java and Tomcat background, so please bear that in mind.) I'm working on my first .Net application, using Visual Studio 2013, C#, .Net 4.5, MVC 5, and EF 6. It's a fairly simple…
Wally Hartshorn
  • 905
  • 2
  • 9
  • 25
1
2
3
51 52