static-files

Using static files with the django virtual server

孤人 提交于 2019-11-27 04:07:33
问题 Questions exactly like this have been asked before, i've read them all and tried to make sense of the official django documentation on the subject but i'm still struggling to use static files on the virtual server. More specifically i'm just trying to get my template, Base.html , to use base.css. My folder structure looks like this: manage.py static/CSS/base.css VergeGreenITEvent_Website/settings.py VergeGreenITEvent_Website/views.py ect VergeGreenITEvent_Website/Webpage_Templates/Base.html

Django runserver not serving static files in development

我是研究僧i 提交于 2019-11-27 02:38:46
问题 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 prominent being the STATICFILES_DIRS , but that does not work for me. How can I set it so that in my development environment I can see the static files, and when I upload my files to the server I do not need to make any changes for the production

'collectstatic' command fails when WhiteNoise is enabled

元气小坏坏 提交于 2019-11-27 01:31:34
问题 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 last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "

How to serve all existing static files directly with NGINX, but proxy the rest to a backend server.

浪子不回头ぞ 提交于 2019-11-26 23:30:35
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; break; } if (!-f $request_filename) { proxy_pass http://127.0.0.1:8080; # backend server listening break; } } Above will serve all existing files directly using Nginx (e.g. Nginx just displays PHP source code), otherwise forward a request to Apache. I need to exclude *.php files from the rule so that requests for *.php are also passed to Apache and processed. I want Nginx to handle all static

Django and Serving Static Files

本秂侑毒 提交于 2019-11-26 22:05:31
问题 I'm hosting a site on WebFaction using Django/mod_python/Python2.5. I've recently run into the concept of static files (when setting up my Django admin). From what I understand, serving static files is simply the idea of telling the server to serve files directly from a specific directory, rather than first routing the request through apache, then mod_python, then django, and finally back to the user. In the case of WebFaction this helps especially since there are two Apache servers that your

How to set-up a Django project with django-storages and Amazon S3, but with different folders for static files and media files?

妖精的绣舞 提交于 2019-11-26 21:11:06
I'm configuring a Django project that were using the server filesystem for storing the apps static files ( STATIC_ROOT ) and user uploaded files ( MEDIA_ROOT ). I need now to host all that content on Amazon's S3, so I have created a bucket for this. Using django-storages with the boto storage backend, I managed to upload collected statics to the S3 bucket: MEDIA_ROOT = '/media/' STATIC_ROOT = '/static/' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = 'KEY_ID...' AWS_SECRET_ACCESS_KEY = 'ACCESS_KEY...' AWS_STORAGE_BUCKET_NAME = 'bucket-name' STATICFILES

Use nginx to serve static files from subdirectories of a given directory

谁都会走 提交于 2019-11-26 19:14:27
问题 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 at /home/www-data/mysite/public/doc/foo/bar.html . You can think of foo as the set name, and bar as the file name here. I wonder whether the following piece of nginx config would do the job: server { listen 8080; server_name www.mysite.com mysite.com

Prevent IIS from serving static files through ASP.NET pipeline

喜夏-厌秋 提交于 2019-11-26 15:58:45
问题 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 requests. I've seen conflicting approaches to change this behavior - What is the best way to do this? 回答1: I'm taking a guess here and suspect that you have the following setting configured in your web.config file: <modules

Django Static Files Development

纵饮孤独 提交于 2019-11-26 15:38:47
问题 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 from C:/Users/Dan/seminarWebsite/static/ , in which I have sub folders for images, css etc. SETTINGS: STATIC_ROOT = 'C:/Users/Dan/seminarWebsite/static/' STATIC_URL = '/static/' The static files app is also active. URLS: from django.contrib

Deploy Nodejs on Heroku fails serving static files located in subfolders

≡放荡痞女 提交于 2019-11-26 11:26:31
问题 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 files located in sub folders. www.example.com/bar.js // this serves the file /htdocs/bar.js www.example.com/foo/bar.js // this can\'t find the file /htdocs/foo/bar.js I forgot to say that on my local environment everything works fine, might be