django-staticfiles

Django Whitenoise 500 server error in non debug mode

倾然丶 夕夏残阳落幕 提交于 2021-02-19 03:28:10
问题 I am using django in my local machine. In order to serve the static files I used WhiteNoise along with it. When DEBUG = True all static files are correctly served. But when I changed DEBUG = False and set ALLOWED_HOSTS = ['*'] I'm getting 500 server error. However admin site loads without any error. Also when I comment out STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' I don't get 500 error. I followed the documentation given in http://whitenoise.evans.io/en

How to run static file when debug is false? [closed]

感情迁移 提交于 2021-02-13 17:41:16
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 days ago . Improve this question With debug turned off Django won't handle static files for you any more - your production web server. Implement this code inside your project: settings.py STATIC_DIR=os.path.join(BASE_DIR,'static') STATIC_URL = '/static/' if DEBUG: STATICFILES_DIRS = [ STATIC_DIR,

How to run static file when debug is false? [closed]

有些话、适合烂在心里 提交于 2021-02-13 17:39:27
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 days ago . Improve this question With debug turned off Django won't handle static files for you any more - your production web server. Implement this code inside your project: settings.py STATIC_DIR=os.path.join(BASE_DIR,'static') STATIC_URL = '/static/' if DEBUG: STATICFILES_DIRS = [ STATIC_DIR,

404 Static file not found - Django

一个人想着一个人 提交于 2021-02-11 12:38:21
问题 I have an issue with django. I recently bought an instance of a shared server and I wanted to move my django website from AWS to this server (which use Cpanel). All worked fine with AWS but when I switched to Cpanel all statics files were missing. this is my settings.py: STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = "/media/" STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] my project structure: my

Static files doesn't load anymore - Django

独自空忆成欢 提交于 2021-01-29 13:37:11
问题 In the beginning everything worked perfectly fine, but now I have a problem where my static files doesn't load. I think this is a very weird problem since I didn't really touch anything that could've had an influence on the problem when it happened. Everything else is working fine, I just can't get the static files for some reason. I sometimes get a 200 http response trying to get the static files like so: [20/Aug/2020 16:12:51] "GET /order/checkout/ HTTP/1.1" 200 2029 [20/Aug/2020 16:12:51]

Static Files not getting loaded in Django Python

笑着哭i 提交于 2021-01-29 05:20:34
问题 Here is the code I am trying to run: {% load staticfiles %} <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> body { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } .x.axis path { display: none; } </style> <script src="http://d3js.org/d3.v3.js"></script> <script src="http://misoproject.com/js/d3.chart.js"></script> </head> <body> <script src="{% static 'stock-line.js' %}"></script> <script src="{% static 'stock-line-app.js'

Correctly accessing django static files from external javascript

别说谁变了你拦得住时间么 提交于 2021-01-27 15:02:06
问题 I've got a django application using AngularJS with a bunch of JavaScript and template files. In my django template I can use the {% static %} tag to properly reference those files like so: <script src="{% static "angular/myapp.app.js" %}"></script> However, the external files themselves obviously do not get resolved through django's templating framework and so that's not an option. So what people most often do is just hard code the static path there: $routeProvider.when('/', { // this works

Replacing django-admin's bootstrap theme's default logo

元气小坏坏 提交于 2021-01-05 11:20:28
问题 I have generated a django-admin for my app and I can access the dashboard. But it contains a logo that says "django admin". I want to change it to my own custom logo. How can I do that? I have tried adding a base.html file to admin directory and tried to override but for some reason it's not working. It's code is as follows: {% extends "admin/base.html" %} {% load theming_tags %} {% load staticfiles %} {% block blockbots %} {{ block.super }} {# Using blockbots ensures theming css comes after

Replacing django-admin's bootstrap theme's default logo

瘦欲@ 提交于 2021-01-05 11:16:07
问题 I have generated a django-admin for my app and I can access the dashboard. But it contains a logo that says "django admin". I want to change it to my own custom logo. How can I do that? I have tried adding a base.html file to admin directory and tried to override but for some reason it's not working. It's code is as follows: {% extends "admin/base.html" %} {% load theming_tags %} {% load staticfiles %} {% block blockbots %} {{ block.super }} {# Using blockbots ensures theming css comes after

Static files not being served on AWS Lightsail

狂风中的少年 提交于 2020-12-25 21:23:31
问题 After 2 days of trying multiple tutorials & reading StackOverflow, I'm calling for help! The setting: The development version is running smoothly on the AWS Lightsail server. It's during the production deployment that I'm running in continuous problems with the static files. The application runs on the appointed subdomain but it's missing all the JS/CSS/images/... I have followed the official docs but to no avail. 1/ https://docs.bitnami.com/aws/infrastructure/django/get-started/deploy-django