Today I deployed my project on a hosting server and since I have DEBUG = False
I have an internal server error too. The full report is:
/storage.py", line 280, in stored_name
cache_name = self.clean_name(self.hashed_name(name))
File "/home/ttipprotest/lib/python3.4/django/contrib/staticfiles
/storage.py", line 94, in hashed_name
(clean_name, self))
ValueError: The file 'css/styles.css' could not be found with
<django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at
0x7f2787c23ef0>.
Everything was working fine in developement, but now I am trying to solve this problem during the whole day. Sorry for displaying the error message that bad.
EDIT:
in prod settings:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
STATIC_URL = '/static/'
STATIC_ROOT = "/home/ttipprotest/webapps/ttipprotest_static/"
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static', 'our_static'),
)
MEDIA_URL = '/media/'
MEDIA_ROOT = "/home/ttipprotest/webapps/ttipprotest_media/"
Project structure:
src
-ttipprotest
--manage.py
--settings
---base.py
---prod.py
-app 1
-...
-app n
-static
--our static
---css
---js
---fonts
-templates
SECOND EDIT:
The problem appears every time when it comes to rendering a template it seems. Here is the index.html. I guess it is the source of this behavior since I figured out that other applications without this index.html are working fine.
{% load staticfiles %}
{% load crispy_forms_tags %}
答案 0 :(得分:3)
在我编辑时发现错误。
在// Doesn't Compile, No Property1 found in x.
IEnumerable<int> results = arr.MySelect(x => x.Property1);
// Compiles and throw a run-time error as there is no Message property in string.
IEnumerable<int> results2 = arr.MySelect2<string, int>(nameof(Exception.Message));
:
index.html
与{% load staticfiles %}
完美配合。至少它是渲染和显示模板,但在日志文件中显示错误。 DEBUG = True
是大多数其他模板延伸的模板。
我将index.html更改为:
index.html
它与{% load static %}