0

I am working on a Django project. I am working on the register page. When I try to import my register/views.py to my mysite/urls.py file I get an error message. ModuleNotFoundError: No Module named 'register'. Both files are are in the same directory.

from django.contrib import admin
from django.urls import path, include
from register import views as v

enter image description here

Adding full exception message enter image description here

PythonCoder1981
  • 403
  • 9
  • 19

2 Answers2

0

Try the following:-

from . import views
Lars
  • 1,234
  • 1
  • 8
  • 31
0

Please add a blank __init__.py file in the register folder. Only then python will understand that register is an importable package

Edit: After seeing the exception, it looks like a working directory issue in pycharms. Please try the fix mentioned in this link

Arjun Ariyil
  • 386
  • 3
  • 14