Closed cezar77 closed 6 years ago
The problem with settings.py formatting is that installer uses string replacing over the one generated by django-admin for improved compatibility with different django versions
The TEMPLATES
indentation should be now easy to fix as we don't need to support old syntax anymore, others might be more problematic
If you want to propose improvements, feel free to open PRs
Fixed by #314 Thanks @cezar77 for reporting
The
settings.py
generated bydjangocms-installer
is not very well formed. There are 3 general issues that bother me:1. The module
os
is imported twice.The first 3 lines of
settings.py
are:After that a docstring follows and the following lines:
There is redundancy here. Also there should be preferably no code before the initial docstring.
2. The white space between the lines is irregular and occasionally to big.
After the comment:
there are 5 lines, then there is another line of code followed by 3 lines. Few lines later there is a comment as a prelude to the database configuration followed by 4 empty lines. The database configuration is instead found toward the end of the file.
3. The indentation of the constant
TEMPLATES
is malformed.The indentation for
TEMPLATES[0]['OPTIONS']['context_processors']
andTEMPLATES[0]['OPTIONS']['loaders']
is only 4 spaces (1 tab), where it should be 16 spaces (4 tabs). That should be obvious from the structure of the aforementioned constant.For me it worked to change 2 lines in the function
_build_settings
in the file__init__.py
in the directorydjango
. That is the following block starting on line 263:The changes are in bold. However I don't know if this would be a general solution.