Closed A4TIF closed 4 years ago
What kind of errors? I mean, I was trying to reproduce the issue, have written this line in my settings:
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
Restarted the runserver
and the static files are just loading fine (even the datepicker3.css
):
So, it would be helpful if you could write some instructions or give some code to see what happens and why it's happening, even the python
/django
/django-cruds-adminlte
versions you're using (pip freeze > mypackages.txt
inside your environment).
Thanks.
Please try it with DEBUG = False
Please try it with DEBUG = False
Also tried with DEBUG = False
and it works for me (the favicon.ico
is the only 404 I get but that's matter of different issue I guess because there is no favicon 🤦♂). I'll be really glad if you could give more information to reproduce the issue.
Just to confirm, did you run manage.py collectstatic?
I get 500 error after running collectstatic and it is pointing to:
ValueError: Missing staticfiles manifest entry for '/datepicker/datepicker3.css'
I even tried using a custom class extending ManifestStaticFilesStorage and added manifest_strict = False, but still get the same error.
Yep I ran the collectstatic
, there is a warning out there but nothing related:
So strange, it has to be something else.
Here's my requirements.txt
Django>=2.2,<2.3
psycopg2>=2.7,<3.0
git+git://github.com/oscarmlage/django-cruds-adminlte/@0.0.17+git.081101d#egg=django-cruds-adminlte
django-crispy-forms==1.7.2
easy-thumbnails==2.6
django-image-cropping==1.2.0
djangoajax==2.3.7
django-select2==7.1.0
requests==2.22.0
django-phonenumber-field==3.0.1
phonenumberslite==8.10.16
djangorestframework==3.10.2
markdown==3.1.1
django-filter==2.2.0
django-extra-fields==1.2.4
django-map-widgets==0.2.2
Here are the important bits from settings.py:
DEBUG = False
INSTALLED_APPS = [
'myapp',
'crispy_forms',
'django_select2',
'easy_thumbnails',
'image_cropping',
'django_ajax',
'cruds_adminlte',
'phonenumber_field',
'rest_framework',
'rest_framework.authtoken',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.gis',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'mapwidgets',
]
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STATICFILES_DIRS = [
os.path.join(PROJECT_DIR, 'static'),
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static_cdn')
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media_cdn')
MEDIA_URL = '/media/'
Errors in my console after running collectstatic:
web_1 | [20/Aug/2019 16:36:45] "GET / HTTP/1.1" 500 27
web_1 | [20/Aug/2019 16:36:46] "GET /favicon.ico HTTP/1.1" 302 0
web_1 | [20/Aug/2019 16:36:46] "GET /static/images/favicon.cd90d4f20517.ico HTTP/1.1" 500 27
Realized that Manifest storage wont work on local, but I tested with a separate apache server serving the static files and found the same error:
ValueError: Missing staticfiles manifest entry for '/datepicker/datepicker3.css'
I fixed the error by changing the leading slash in adminlte/lib/_styles.html and now the error has gone and all working fine :)
Also, noticed that cruds/base.html was loading staticfiles, whereas Django mentions loading static only.
PR here: #120
PR was merged, closing issue.
Looks like it has to do with _styles.html
I noticed static paths with {% static "/datepicker/datepicker3.css" %} with forward-slash in the path, which probably causes the problem. Can someone verify this?