Closed YUX closed 3 years ago
Follow the install steps, or maybe run collectstatics
, or maybe change the static storage setting. It's a Django issue, so if nothing fixes it try stackoverflow. I can't really help if I can't reproduce the issue.
FWIW, https://community.spirit-project.com/ runs with the default prod settings...
I was able to reproduce it locally, just run the spiritinstall
command (it'll run collectstatics
among other things).
thank you for your responses, but collectstatics
didn't fix the problem for me.
I get 0 static files copied to '/Users/yux/Documents/Projects/mysite/static', 2122 unmodified.
then the same ValueError: Missing staticfiles manifest entry for 'spirit/stylesheets/styles.all.min.css'
when I run in production settings.
I've tried different Django version on another server, I got the same error.
❯ pip list
Package Version
--------------------------------- -------------------
asgiref 3.3.1
certifi 2020.12.5
Django 3.1.4
django-djconfig 0.10.0
django-haystack 3.0
django-infinite-scroll-pagination 1.1.0
django-spirit 0.12.1
mistune 0.8.4
olefile 0.46
Pillow 8.0.1
pip 20.3.3
pytz 2020.4
setuptools 49.6.0.post20201009
sqlparse 0.4.1
wheel 0.36.2
Whoosh 2.7.4
I ran the exact commands in the Docs
pip install django-spirit
spirit startproject mysite
cd mysite
python manage.py spiritinstall
python manage.py createsuperuser
python manage.py runserver
everything looks great on http://127.0.0.1:8000
then I created prod_local.py
from .prod import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
ALLOWED_HOSTS = ['127.0.0.1', ]
then python manage.py runserver --settings=mysite.settings.prod_local
and things break.
I get the ``` ValueError: Missing staticfiles manifest entry for 'spirit/stylesheets/styles.all.min.css' ERROR 2020-12-20 00:18:12,377 basehttp 30325 6200111104 "GET / HTTP/1.1" 500 145
Well, you are running the commands using the default config (dev), and then running the server using the prod settings. That's the issue. You must run all commands using the prod settings, ex python manage.py spiritinstall --settings=mysite.settings.prod_local
, if that doesn't work, then modify the manage.py to use the prod_local settings (that's what I do).
thank you for these instructions, finally I didn't see the ValueError after I had modified manage.py. and I can see the right staticfiles.json
file.
but when I check in Firefox I see the http://127.0.0.1:8000/static/spirit/stylesheets/styles.all.min.02f514517c22.css
and http://127.0.0.1:8000/static/spirit/scripts/all.min.7c6099484c1c.js
are 404.
yet I can see those files with hash in the file name in the folder.
Yeah, Django only serves static files when setting DEBUG = True
, which you don't want to do in a prod server. You can either install and configure Whitenoise, or use Nginx to serve the static files, and while you are at it, you may want to use Nginx as a reverse proxy for Spirit, and also use a better webserver like gunicorn instead of the Django built-in server.
I see. This is an awesome project. Thank you very much.
ValueError when I run in production settings while works great on dev settings.
ValueError: Missing staticfiles manifest entry for 'spirit/stylesheets/styles.all.min.css'