Error While Importing Urlconf No Module Named
Contents |
Previous TicketNext Ticket → Opened 8 years ago Closed 8 years ago Last modified 5 years ago #8596 closed (invalid) Error while importing URLconf 'mysite.urls': No module named models Reported by: Adrian Ribao Owned by: nobody Component: contrib.admin Version: master Severity: Keywords: Cc: Triage Stage: Unreviewed Has patch: no module named urls django yes Needs documentation: no Needs tests: no Patch needs improvement: no Easy pickings: UI/UX:
From Django.urls Import Reverse No Module Named Urls
Description After upgrading to rev [8617], I get an error caused by: admin.autodiscover() The exception value is: Error while importing URLconf 'mysite.urls': from django.urls import reverse importerror: no module named urls No module named models I can't tell much more about it as the traceback is not useful. The installed apps looks like: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.sitemaps', 'blog', I have tried with
Import Reverse Django
mysite.blog in INSTALLED_APPS but I get another error about importing. Attachments (1) __init__.py.patch (578 bytes) - added by Adrian Ribao 8 years ago. django/contrib/admin/init.py modified Download all attachments as: .zip Oldest first Newest first Threaded Show comments Show property changes Change History (13) comment:1 Changed 8 years ago by Julien Phalip Needs documentation: unset Needs tests: unset Patch needs improvement: unset Could you show the code of your custom admin.py files? It's likely django no module named urls reverse that you're doing a wrong import in one of them. comment:2 Changed 8 years ago by Adrian Ribao The admin was working before the upgrading. I have 13 custom admin, and I have commented all the lines in each file and I'm still getting the same error. comment:3 Changed 8 years ago by Malcolm Tredinnick So go back to a version that works, then go to something halfway in between and see if that works. If so, move forwards halfway again, otherwise move back halfway. After a few checkouts, you'll find the exact version that caused the breakage. That will be of some help in trying to work out where the problem lies. comment:4 Changed 8 years ago by Adrian Ribao The problem lies in changeset [8583], I'll try to find out what's the problem. Changed 8 years ago by Adrian Ribao Attachment: __init__.py.patch added django/contrib/admin/init.py modified comment:5 follow-up: 6 Changed 8 years ago by Adrian Ribao Has patch: set I have attached a patch. This just make the site work if there is some error making an import. My site is working now but there is no admin interface for one of my apps. I think it must be a problem with namespaces but it's one of the most weird s things I have ever
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the
Root_urlconf
workings and policies of this site About Us Learn more about Stack
Django Rest Swagger
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs django tutorial Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join https://code.djangoproject.com/ticket/8596 them; it only takes a minute: Sign up Import error when importing python file from same directory up vote 0 down vote favorite I have the identical problem to the question posed here: Django custom form ImportError even though file is in the same directory This is from my urls.py in a django application: import bulkEdit ... ... urlpatters = http://stackoverflow.com/questions/20356810/import-error-when-importing-python-file-from-same-directory patterns('', url(r'^engine/$', component_views.engine, name='engine'), ... url(r'^admin/', include(bulkEdit.urls)), My bulkEdit.py file is in the same directory as urls.py. The error I get is File "/home/context/work/riot/src/venv/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module __import__(name) ImportError: No module named bulkEdit I get the same error if I try from bulkEdit import urls as bulkEditUrls ... ... urlpatters = patterns('', url(r'^engine/$', component_views.engine, name='engine'), ... url(r'^admin/', include(bulkEditUrls)), bulkEdit is a file in the same directory as my urls.py file; file structure is Rapier |-component | |-__init__.py | |-admin.py | |-forms.py | |-models.py | |-views.py | |-Chassis | |-__init__.py | |-urls.py | |-bulkEdit.py | |-settings.py | |-views.py | |-manage.py here is what I have tried so far (In all of these cases, 'Chassis' is in INSTALLED_APPS): Using Python 2.7, so I get a syntax error with import .bulkEdit I've also tried: url(r'^admin/', include(Chassis.bulkEdit.urls)), gives me NameError: name 'Chassis' is not defined url(r'^admin/', include("Chassis.bulkEdit.urls")), gives me ImportError: No module named urls url(r'^admin/', include("Chassis.bulkEdit")), gives me ImproperlyConfigured: The included urlconf
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://stackoverflow.com/questions/21561817/django-importerror-no-module-named-report-when-i-dont-have-anything-named-repor the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. no module Join them; it only takes a minute: Sign up Django ImportError No module named report when I don't have anything named report at all up vote 0 down vote favorite I'm trying to put a url in my navigation as so: