Intro
I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux)
The problem
On one of the computers we are getting "Unresolved reference" all over the code on almost every import with the exception of Python's built in libraries (i.e. import datetime is working). This computer is running the Mac version of Pycharm.
The question
Anyone knows how to solve this?, since most of the imports are not recognized code completion and navigation trough goto->declaration and so on is not working. Is there any known issue with the Mac version?
Thanks in advance!
The key is to mark your source directory as a source root. Try the following:
The folder should now appear blue instead of beige, to indicate it is a Python source folder.
You can also configure this in PyCharm preferences by doing the following for a project that is already in PyCharm:
I also had the problem, and it took me few hours to find the exact solution.
You need to confirm the following things.
'django.contrib.staticfiles'
, is added to INSTALLED_APPS
in the settings.py
file of your application.
The directory with the static contents (for example, images), named static
, resides under the application root.
PyCharm > Preferences > Project Settings > Django
Make sure your Django Project root
, Settings.py
and manage.py
script are well defined in the dialog box.
You are good to go. Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With