makemigrations views imports problem

Hello. I’m having problem when I set the command python makemigrations.

I get this console output:

File “/home/jaodev/ftp/files/CallServiceBackEnd/callservices/”, line 23, in
from callserviceapp.views import homeCliente, homeClientePedirDatos, proveedorUbicacion
ImportError: cannot import name ‘homeCliente’

Why can not import the function homeCliente in server? I have not this problem at the localhost (in my computer)

from django.conf.urls import url
from django.contrib import admin
from django.urls import path

from django.conf import settings
from django.conf.urls.static import static

from callserviceapp.views import homeCliente, homeClientePedirDatos, proveedorUbicacion

urlpatterns = [

    path('home/cliente/<lat>/<long>', homeCliente),
    path('home/cliente/pedirdatos/<email>/<rubro>/<tipoPedido>/<lat>/<long>', homeClientePedirDatos),

    path('proveedor/ubicacion/<email>/<lat>/<long>', proveedorUbicacion),

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

this is the folder structure

First step would be to verify your files and directory structure on the server. Make sure that all the files needing to be there have been properly created and that they are complete and correct.

Then verify that there are no permissions issues related to your directory structure - that the files and directories have the right permissions on them for the account being used to access them.

1 Like

Happy Birthday Ken. Yes, the directory structure is the same. The permission are OK

Also, the django version are the same 3.2.13

How about Python versions? Are you using the same version of Python in both locations? Are you using a virtual environment on the server? Have you verified it?

Have you checked your settings file to ensure there are no path issues?

Have you tried removing the urls and the import to determine if this is the only issue or an indication of a larger problem?

1 Like

Thanks but the python version are the same. Im not using virtualenv and if I delete the imports the app can not find the functions. So, It’s a weird problem and also in the web I can not find a solution.

So comment out those as well.

This is all part of the diagnostic process. The intent is to identify what is different between the two environments to determine what’s wrong. Without any clear indication of an error, then you need to just start removing where errors are being identified until you find out what is causing the problem.

1 Like

If I delete the imports I get:

File “/home/jaodev/ftp/files/CallServiceBackEnd/callservices/”, line 13, in
path(‘home/cliente//’, homeCliente),
NameError: name ‘homeCliente’ is not defined

Everything would indicate that it can and does find the functions (methods defined in but for some reason it is block.

Traceback (most recent call last):
File “”, line 21, in
File “”, line 17, in main
File “/usr/local/lib/python3.6/dist-packages/django/core/management/”, line 419, in execute_from_command_line
File “/usr/local/lib/python3.6/dist-packages/django/core/management/”, line 413, in execute
File “/usr/local/lib/python3.6/dist-packages/django/core/management/”, line 354, in run_from_argv
self.execute(*args, **cmd_options)
File “/usr/local/lib/python3.6/dist-packages/django/core/management/”, line 393, in execute
File “/usr/local/lib/python3.6/dist-packages/django/core/management/”, line 423, in check
File “/usr/local/lib/python3.6/dist-packages/django/core/checks/”, line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File “/usr/local/lib/python3.6/dist-packages/django/core/checks/”, line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File “/usr/local/lib/python3.6/dist-packages/django/core/checks/”, line 57, in _load_all_namespaces
url_patterns = getattr(resolver, ‘url_patterns’, )
File “/usr/local/lib/python3.6/dist-packages/django/utils/”, line 48, in get
res = instance.dict[] = self.func(instance)
File “/usr/local/lib/python3.6/dist-packages/django/urls/”, line 602, in url_patterns
patterns = getattr(self.urlconf_module, “urlpatterns”, self.urlconf_module)
File “/usr/local/lib/python3.6/dist-packages/django/utils/”, line 48, in get
res = instance.dict[] = self.func(instance)
File “/usr/local/lib/python3.6/dist-packages/django/urls/”, line 595, in urlconf_module
return import_module(self.urlconf_name)
File “/usr/lib/python3.6/importlib/”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/home/jaodev/ftp/files/CallServiceBackEnd/callservices/”, line 23, in
from callserviceapp.views import homeCliente, homeClientePedirDatos, proveedorUbicacion
ImportError: cannot import name ‘homeCliente’

If you remove the imports, you need to remove the urls referencing those imported functions as well.

1 Like

If I delete the imports and the urls referencing, there is not problem. But the problems is with all referencing. Because to make the makemigrations only it runs with none of the referencing.

So if makemigrations works without references to the callserviceapp/ file, I would think that the problem is in that file.

So I’m curious - what did the problem turn out to be?

Everything indicates that for some reason there was an error in the data pull from the code repository. The last code lines were missing. First time this happens to me I didn’t fully review the code until the end (because I never saw it as a possibility).

Cloning the repository again fixed it.