I'm developing a simple api rest With Django 2.2.1, djangorestframework and Python 3, but I'm stuck when try to run 'makemigrations' command, receiving the following message:

return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'clients.urls'

My project folder structure is the following:


I've tried to import clients in urls.py and settings.py and nothing changed. I need to get this project done for a interview test but I'm stuck in this that looks like a silly detail that I'm not seeing. I hope some of you can help me see whats is wrong with my code and what is the pattern when generating the project and app. Is the folder structure above correct for a django rest api project?

My urls.py:

from django.contrib import admin
from django.urls import path, include
#import clients I've tried this with no success

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('clients.urls'))

1 Answers

Anjaneyulu Batta On Best Solutions

You have no module clients/urls.py that's the reason it's showing the error ModuleNotFoundError: No module named 'clients.urls'.

Create file clients/urls.py then it will work.