collectstatic

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

Django media files not showing with Debug = False on production - Django 1.10

孤街浪徒 提交于 2021-01-02 05:46:11
问题 I currently have two kind of files static files and media files.The static files contain my css,js and other static content. The media files contain stuff that the user uploads.The static folder is right next to the media folder.Now on my deployed machine. If I set the DEBUG = False my static files are presented just fine however my media content is never displayed. I get a 404 not found error. My quuestion is how do I display media content in production environment when DEBUG = False. With

collecstatic does not push to files S3

不羁的心 提交于 2020-05-10 03:37:34
问题 EDIT: I have found that removing import django_heroku from my settings.py file allows me to push my static files to my AWS bucket. When I uncomment import django_heroku , collectstatic then pushes my files to the staticfiles folder. manage.py collectstatic with #import django_heroku : You have requested to collect static files at the destination location as specified in your settings. maange.py collectstatic with import django_heroku : You have requested to collect static files at the

collecstatic does not push to files S3

℡╲_俬逩灬. 提交于 2020-05-10 03:34:20
问题 EDIT: I have found that removing import django_heroku from my settings.py file allows me to push my static files to my AWS bucket. When I uncomment import django_heroku , collectstatic then pushes my files to the staticfiles folder. manage.py collectstatic with #import django_heroku : You have requested to collect static files at the destination location as specified in your settings. maange.py collectstatic with import django_heroku : You have requested to collect static files at the

What's the point of Django's collectstatic?

独自空忆成欢 提交于 2019-12-17 10:18:32
问题 This is probably a stupid question, but it's just not clicking in my head. 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, views.py, etc) static/ In mysite/settings.py I have: STATIC_ROOT = 'staticfiles' So when I run the command: python manage.py collectstatic It creates a folder called staticfiles at the

How do I put a background image on the body in css with django using static?

依然范特西╮ 提交于 2019-12-13 03:43:16
问题 How do I put a background image on the body in css with django using static? Is it something like this? I can't find any information on this. Thanks. {% load static %} body { padding: 0 20px; background-image: url("{% static "assets/images/2.gif" %}"); } 回答1: Use a relative path. Relative to the folder where the css file reside. background: url('../assets/images/2.gif'); And use it in template file like this: {% load staticfiles %} <link href="{% static 'css_file_address' %}" rel="stylesheet"

Using Django's collectstatic with boto S3 throws “Error 32: Broken Pipe” after a while

自古美人都是妖i 提交于 2019-12-01 15:20:21
I'm using boto with S3 to store my Django site's static files. When using the collectstatic command, it uploads a good chunk of the files perfectly before stopping at a file and throwing "Error 32: Broken Pipe." When I try to run the command again, it skips over the files it has already uploaded and starts at the file where it left off, before throwing the same error without having uploaded anything new. The key seems to be to specify which AWS Endpoint your bucket is located in. I tried doing this a bunch of different ways, but the solution that finally worked for me was to create a config

Using Django's collectstatic with boto S3 throws “Error 32: Broken Pipe” after a while

╄→гoц情女王★ 提交于 2019-12-01 14:13:53
问题 I'm using boto with S3 to store my Django site's static files. When using the collectstatic command, it uploads a good chunk of the files perfectly before stopping at a file and throwing "Error 32: Broken Pipe." When I try to run the command again, it skips over the files it has already uploaded and starts at the file where it left off, before throwing the same error without having uploaded anything new. 回答1: The key seems to be to specify which AWS Endpoint your bucket is located in. I tried

Collectstatic error while deploying Django app to Heroku

风流意气都作罢 提交于 2019-11-28 15:44:44
I'm trying to deploy a Django app to Heroku, it starts to build, download and installs everything, but that's what I get when it comes to collecting static files $ python manage.py collectstatic --noinput remote: Traceback (most recent call last): remote: File "manage.py", line 10, in <module> remote: execute_from_command_line(sys.argv) remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line remote: utility.execute() remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py"

What's the point of Django's collectstatic?

爱⌒轻易说出口 提交于 2019-11-27 11:00:35
This is probably a stupid question, but it's just not clicking in my head. 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, views.py, etc) static/ In mysite/settings.py I have: STATIC_ROOT = 'staticfiles' So when I run the command: python manage.py collectstatic It creates a folder called staticfiles at the root level (so same directory as myapp/) What's the point of this? Isn't it just creating a copy of all