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 = 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 <module 'Chassis.bulkEdit' from '/home/userag/work/project/src/project/Chassis/bulkEdit.pyc'> doesn't have any patterns in it
url(r'^admin/', include(Chassis.bulkEdit)),
gives me NameError: name 'Chassis' is not defined
When I have
import bulkEdit
...
test = url(r'^admin/', include(bulkEdit.urls))
I get no error as long as it is not in the urlpatterns. When I add test to urlpatterns
urlpatterns = patterns('',
url(r'^engine/$', component_views.engine, name='engine'),
...
test
I get the error. Is there somewhere else I need to import bulkEdit due to me doing things with admin forms?
import .bulkEdit. It is a file in the same directory as urls.py