-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure to import settings? #325
Comments
I've came across the same problem. A hack was to insert this:
Right above the Edit: Setting |
Same issue encountered here, similar Unfortunately, none of the above hacks worked for me python 3.9.5 |
From what you've posted none of this is clear and I'm not seeing a |
Sorry, I guess I wasn’t clear enough.
Current working directory - /gallery/quickbbs (which contains manage.py)
The django project- is named quickbbs, and has two subdirectories:
frontend
quickbbs
along with the directories as shown in the previous message
The quickbbs/quickbbs directory is the django main folder, which contains the settings.py, models.py, and etc..
Python path:
export ***@***.***/libexec/bin:$PATH"
export PATH="/usr/local/lib/python3.9/site-packages:$PATH"
Contents of the quickbbs/quickbbs directory (to be clear, since I’m running from /gallery/quickbbs, this is the quickbbs directory that is referenced in the command line):
(quickbbs) benjamin@Nerv quickbbs % ls quickbbs
BBEditCheckSyntaxTemp-settings.pyc jinjaenv.py migrations urls.py
__init__.py logger.py models.py urls.pyc
__init__.pyc logger.pyc models.pyc wsgi copy.py
__pycache__ middleware settings.py wsgi.py
asgi.py middleware.py settings.pyc wsgi.pyc
Now after updating pylint:
pylint 2.8.3
pylint-django 2.4.4
And changing:
export DJANGO_SETTINGS_MODULE=quickbbs
I am getting different results:
quickbbs) benjamin@Nerv quickbbs % pylint --load-plugins pylint_django frontend/views.py
************* Module frontend.views
frontend/views.py:87:0: C0301: Line too long (119/100) (line-too-long)
frontend/views.py:291:0: C0301: Line too long (104/100) (line-too-long)
frontend/views.py:31:0: E0401: Unable to import 'frontend.archives3' (import-error)
frontend/views.py:34:0: E0401: Unable to import 'frontend.ftypes' (import-error)
frontend/views.py:35:0: E0401: Unable to import 'frontend.config' (import-error)
frontend/views.py:36:0: E0401: Unable to import 'frontend.database' (import-error)
frontend/views.py:37:0: E0401: Unable to import 'frontend.thumbnail' (import-error)
frontend/views.py:39:0: E0401: Unable to import 'frontend.utilities' (import-error)
frontend/views.py:42:0: E0401: Unable to import 'frontend.watchdogmon' (import-error)
frontend/views.py:44:0: E0401: Unable to import 'frontend.web' (import-error)
frontend/views.py:45:0: E0401: Unable to import 'frontend.web' (import-error)
frontend/views.py:46:0: E0611: No name 'models' in module 'quickbbs' (no-name-in-module)
frontend/views.py:46:0: E0401: Unable to import 'quickbbs.models' (import-error)
frontend/views.py:239:0: C0116: Missing function or method docstring (missing-function-docstring)
frontend/views.py:239:0: R0912: Too many branches (13/12) (too-many-branches)
frontend/views.py:239:0: R0915: Too many statements (61/50) (too-many-statements)
frontend/views.py:318:0: C0116: Missing function or method docstring (missing-function-docstring)
frontend/views.py:337:0: C0116: Missing function or method docstring (missing-function-docstring)
frontend/views.py:403:0: C0103: Function name "downloadFile" doesn't conform to snake_case naming style (invalid-name)
frontend/views.py:403:26: W0613: Unused argument 'filename' (unused-argument)
Now I don’t understand why we’re unable to import quickbbs.models, and the other various import errors… But at least it eliminates the django not initialized error.
|
Looks like I m not only the one facing this issues. Did any one get it working? when I try to add this to my settings.json, pylint does not work
before that I had only these lines in
VS code output was. Edit UpdateI figured out what was the problem, If you have any Syntax Errors or Import Error in your files, Pylint stops working on VS code. I would recommend running and seeing if you get any Exceptions.
Here is my settings.json in vscode
Hope this helps ! ✌ |
@tazahmd thank you so much! I imported some settings from environmental variables and had no default values set for them. Since my .env files are read as part of manage.py, they were never loaded and therefore I got those errors. |
Both `DJANGO_SETTINGS_MODULE` and `DJANGO_CONFIGURATION` are required for `django.configurations.importer` to install, else it throws an exception. If the `importer` is not installed, `django.setup()` fails on `configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)` when trying to access uninitialized settings. fixes pylint-dev#309 (pylint-dev#309 (comment)) fixes pylint-dev#325 might relate to pylint-dev#362
A clear answer to this is that the |
I am running into several issues...
But here's my structure:
`
If I use the following, and my settings file does exist as quickbbs/settings.py
But it exceptions with an error indicating that pylint-django can't find the settings file?
I've tried it without the export, and just with the command line option, and I've tried it with the export and without the command line option, same effect.
The export solved the LOGGING error, so I believe that pylint is seeing the settings file, I just don't understand why pylint-django isn't.
Is there some strange syntax that I'm missing? pylint-django use to work fine a while back.... But I haven't touched this project with pylint-django in a quite a while.
The text was updated successfully, but these errors were encountered: