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.
Questions tagged [static-files]
769 questions
801
votes
24 answers
How to serve static files in Flask
So this is embarrassing. I've got an application that I threw together in Flask and for now it is just serving up a single static HTML page with some links to CSS and JS. And I can't find where in the documentation Flask describes returning static…

hughdbrown
- 47,733
- 20
- 85
- 108
139
votes
4 answers
What's the point of Django's collectstatic?
In Django, the convention is to put all of your static files (i.e css, js) specific to your app into a folder called static. So the structure would look like this:
mysite/
manage.py
mysite/ --> (settings.py, etc)
myapp/ --> (models.py,…
user5732453
116
votes
16 answers
Django - Static file not found
I've seen several posts for this issue but didn't found my solution.
I'm trying to serve static files within my Django 1.3 development environment.
Here are my settings
...
STATIC_ROOT = '/home/glide/Documents/django/cbox/static/'
STATIC_URL =…

Pierre de LESPINAY
- 44,700
- 57
- 210
- 307
102
votes
2 answers
Use nginx to serve static files from subdirectories of a given directory
I have several sets of static .html files on my server, and I would like use nginx to serve them directly. For example, nginx should serve an URI of the following pattern:
www.mysite.com/public/doc/foo/bar.html
with the .html file that is located…

MLister
- 10,022
- 18
- 64
- 92
96
votes
3 answers
How to serve all existing static files directly with NGINX, but proxy the rest to a backend server.
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if (-f $request_filename) {
access_log off;
expires 30d;
…

fmalina
- 6,120
- 4
- 37
- 47
56
votes
21 answers
Django -- Can't get static CSS files to load
I'm running Django's development server (runserver) on my local machine (Mac OS X) and cannot get the CSS files to load.
Here are the relevant entries in settings.py:
STATIC_ROOT = '/Users/username/Projects/mysite/static/'
STATIC_URL =…

tchaymore
- 3,728
- 13
- 55
- 86
44
votes
2 answers
What's the better approach: serving static files with Express or nginx?
I'm building a Node.js applications and I'm using nginx as a reverse proxy. My application has some static files I need to serve and a Socket.io server.
I know that I can serve static files directly with Express (using express.static middleware).…

serge1peshcoff
- 4,342
- 11
- 45
- 76
40
votes
11 answers
Turn off caching of static files in Django development server
Is there an easy way to turn off caching of static files in Django's development server?
I'm starting the server with the standard command:
python manage.py runserver
I've got settings.py configured to serve up static files from the /static…

aaronstacy
- 6,189
- 13
- 59
- 72
40
votes
3 answers
Where to run collectstatic when deploying django app to heroku using docker?
I am deploying a Django app to Heroku using Docker. When I put RUN manage.py collectstatic --noinput in the Dockerfile, it fails because there is no value set for the environment variable DJANGO_SECRET_KEY. My understanding is that this is because…

Ryan Knight
- 1,288
- 1
- 11
- 18
37
votes
3 answers
With Flask, how can I serve robots.txt and sitemap.xml as static files?
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…

elssar
- 5,651
- 7
- 46
- 71
34
votes
3 answers
Learning Node - Express Public folder not working
So I'm new to node and trying to learn how to use the express library with it. However, the problem I'm trying to figure out is why the files in my /public folder do not seem to be served as static content.
Here's my code:
var http =…

Tejs
- 40,736
- 10
- 68
- 86
32
votes
9 answers
Route to static file in Play! 2.0
I'm trying to make a route to a specific static file but everything I'm trying ends with an error.
I've made 3 different attempts:
1.
GET /file staticFile:/public/html/file.html
The error I get:
Compilation error
string matching regex `\z'…

Nitzan Tomer
- 155,636
- 47
- 315
- 299
32
votes
16 answers
'collectstatic' command fails when WhiteNoise is enabled
I'm trying to serve static files through WhiteNoise as per Heroku's recommendation. When I run collectstatic in my development environment, this happens:
Post-processing 'css/iconic/open-iconic-bootstrap.css' failed!
Traceback (most recent call…

Pieter
- 31,619
- 76
- 167
- 242
30
votes
1 answer
Django Static Files Development
This seems to be a source of much confusion judging by the amount of similar titles on the subject, however trying everything I could find on static files with the django development server I've almost given up hope!
So my static files are served…

dannymilsom
- 2,386
- 1
- 18
- 19
30
votes
4 answers
Prevent IIS from serving static files through ASP.NET pipeline
Requests for my css, js, image files are being served through the ASP.NET pipeline. I thought IIS by default avoided this, but I see the requests on my Application_AuthenticateRequest breakpoint and there's no need to actually authenticate those…

kenwarner
- 28,650
- 28
- 130
- 173