1

i have problem when i import markdownx. i installed Markdownx for Django, and add in url. and i want to in models.py, but it has problem. problem is.. (Import 'markdownx.models' could not be resolved Pylance(reportMissingImports) [3, 6])

And my code

Settings.py

INSTALLED_APPS = [
    'blog',
    'single_pages',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_extensions',
    'crispy_forms',
    'markdownx',
]

project/urls.py

urlpatterns = [
    path('admin/', admin.site.urls),
    path('blog/', include('blog.urls')),
    path('markdownx/', include('markdownx.urls')),
    path('', include('single_pages.urls')),
]

blog/models.py

from markdownx.models import MarkdownxField


class Post(models.Model):
    title = models.CharField(max_length=30)
    hook_text = models.CharField(max_length=100, blank=True)
    content = MarkdownxField()

when i import this line, it has problem

  • Regardless of the VSCode error, does the code actually run? – MattDMo Sep 05 '21 at 19:28
  • no, i can't run the code.. I wanna know why can't i import markdownx.models ~~. i have install, add url, but it doesn't work. – blake banker Sep 05 '21 at 19:37
  • please, check image what i attached in last line – blake banker Sep 05 '21 at 19:46
  • No, what I mean is, can you run `django-admin runserver` and not get errors? If you do get errors, please edit your question and put them into your post as formatted text, not images. – MattDMo Sep 05 '21 at 19:50
  • Oh, i solve this problem! I rebooted VSCode and it worked fine. I keep having a problem with the 'markdownx.models' line, but it has been fixed. Thanks for the comment! – blake banker Sep 05 '21 at 19:54

0 Answers0