Static Assets #13

Closed
iammerrick opened this Issue Nov 7, 2015 · 2 comments

Comments

3 participants
@iammerrick

Any way to let Django serve the static assets if collectstatic hasn't been run yet? It's sort of a pain to run collectstatic each time you know?

@mjhea0

This comment has been minimized.

Show comment
Hide comment
@mjhea0

mjhea0 Dec 28, 2015

Contributor

You could add it to a shell script:

#!/bin/sh
python /app/manage.py collectstatic --noinput
/usr/local/bin/gunicorn docker_django.wsgi:application -w 2 -b :8000

Then in the production.yml file just run the shell script:

web:
  restart: always
  build: ./web
  expose:
    - "8000"
  links:
    - postgres:postgres
    - redis:redis
  env_file: .env
  command: /shell-script.sh
Contributor

mjhea0 commented Dec 28, 2015

You could add it to a shell script:

#!/bin/sh
python /app/manage.py collectstatic --noinput
/usr/local/bin/gunicorn docker_django.wsgi:application -w 2 -b :8000

Then in the production.yml file just run the shell script:

web:
  restart: always
  build: ./web
  expose:
    - "8000"
  links:
    - postgres:postgres
    - redis:redis
  env_file: .env
  command: /shell-script.sh
@viktorvillalobos

This comment has been minimized.

Show comment
Hide comment
@viktorvillalobos

viktorvillalobos Nov 30, 2017

This give me an error:

web_1 | usage: manage.py collectstatic [-h] [--version] [-v {0,1,2,3}]
web_1 | [--settings SETTINGS] [--pythonpath PYTHONPATH]
web_1 | [--traceback] [--no-color] [--noinput]
web_1 | [--no-post-process] [-i PATTERN] [-n] [-c] [-l]
web_1 | [--no-default-ignore]
web_1 | manage.py collectstatic: error: unrecognized arguments: --noinput

This give me an error:

web_1 | usage: manage.py collectstatic [-h] [--version] [-v {0,1,2,3}]
web_1 | [--settings SETTINGS] [--pythonpath PYTHONPATH]
web_1 | [--traceback] [--no-color] [--noinput]
web_1 | [--no-post-process] [-i PATTERN] [-n] [-c] [-l]
web_1 | [--no-default-ignore]
web_1 | manage.py collectstatic: error: unrecognized arguments: --noinput

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment