Gjert
Gjert

Reputation: 1067

PyCharm unresolved reference

I'm having a fairly weird problem with PyCharm at the moment. The famous unresolved reference problem. I have done the steps which have been encouraged in previous solution to similar problems:

  1. Set source root
  2. Check interpreter
  3. Made sure Add source roots to PYTHONPATH was on
  4. Invalidate cache and reset

None of these have worked out, and its my first time not being able to solve it simply by setting the source root. I am using a virtualenv which I have created simply using virtualenv venv and pip install Django. While also adding it as the PyCharm interpreter.

This is a standard beginner Django project with a single frontpage application, which is of course included in the settings.py file.

Picture of the include that is not found

enter image description here

I have also tried reinstalling PyCharm without any luck. So if anyone have any suggestion on how I can trace down this problem I'd love to hear it.

Upvotes: 1

Views: 536

Answers (1)

rschwieb
rschwieb

Reputation: 786

You haven't imported frontpage anywhere... so PyCharm is doing the right thing. You can do this, but I think you need to quote it like this, as the docstring in your picture indicates:

include('frontpage.urls')

Otherwise you could import frontpage and then frontpage.urls would be in scope.

The "unresolved reference problem" that most people refer to (at least, I ran into it over and over again) involves things being flagged in the imports as not being found on the path. It takes a little bit of fiddling to make sure everything is in place to get a clean inspection.

Upvotes: 1

Related Questions