The error screenshot is as follows:
All static resource files, including css, js, and image files, cannot be found, and encoding error is reported in the background.
I have tried many methods, including setting DEFATULT_CHARSET = 'utf-8' in settings. py, and also tried to add the following statement to manage. py:
Program code
The code is as follows: |
Copy code |
Reload = reload (sys) Sys. setdefaultencoding ("cp1251 ") |
# In fact, an error is reported here. It seems that python2.7 does not support setdefaultencoding.
In this way, it seems that some problems will be solved, but not all. Some css and js files can be opened, but the image still seems to have a problem. You 'd better find a solution to solve the problem:
Add sitecustomize. py to the C: \ Python27 \ Lib \ site-packages directory. The content of sitecustomize. py is as follows:
Program code
The code is as follows: |
Copy code |
Import sys Sys. setdefaultencoding ("cp1251 ") |
Run django server again. Everything is normal.