-
-
Notifications
You must be signed in to change notification settings - Fork 485
ModuleNotFoundError using a custom apps directory & path #224
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
Comments
I think a workaround is to add the
|
I do this too, using a dedicated apps directory, and as @Atala says, I adjust my PYTHONPATH, which works fine. |
This isn't possible when you don't control the calling environment creation such as when mypy is called from the Python extension in VSCode. Could this module respect the https://mypy.readthedocs.io/en/stable/config_file.html#import-discovery |
…env var for import discovery
### Description - Add `allow_unicode` to SlugField (see: https://docs.djangoproject.com/en/5.0/ref/models/fields/#slugfield)
To make my apps more reusable, I prefer to use an
apps
directory in my project root to house them, with the following structure:To make life easier, in
manage.py
, I have the following:This enables me to use e.g.
from app1 import SomeClass
anywhere in the project, instead offrom apps.app1 import SomeClass
.However, this is causing
mypy
withdjango-stubs
(though not without it) to crash a withModuleNotFoundError
:I had a similar issue with PyLint, but was able to solve it with the help of this StackOverflow page, taking advatange of an initialisation hook to set the system path in a similar way to above but in
.pylintrc
, like so:My questions are:
1) Is there a similar approach I can take?
2) Otherwise, what are alternative suggestions?
The text was updated successfully, but these errors were encountered: