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
  • 333
  • 1
  • 13

2 Answers2

0

Try the following:-

from . import views
Lars
  • 1
  • 1
  • 3
  • 25
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
  • 362
  • 3
  • 11