I'm moving a very simple django app from my desktop pc to a virtualbox server.
I have copied the hole proyect, except for the virtualenv sources folder.
Then, i've created a virtualenv and installed dependencies in the same way. When i run manage.py a circular reference error cames in claming The included URLconf 'pmkwebPdf.urls' does not appear to have any patterns in it
This is the project dir:
PmkwebPdf
media
pmkwebPdf
__init.py
settings.py
urls.py
wsgi.py
src
migrations
...
processor
...
__init__.py
admin.py
apps.py
models.py
tests.py
urls.py
views.py
templates
...
venv
...
db.sqlite3
manage.py
It's certanly an error with the urlpatterns. So i did this.
pmkWebPdf.urls
from django.contrib import admin
#from django.urls import path, include
urlpatterns = [
#path('', include('src.urls')),
path('admin/', admin.site.urls),
]
In this file, if i remove the path('', include('src.urls')),
and its dependecies the error is gone.
src/urls.py
from django.conf.urls.static import static
from django.urls import path
from pmkwebPdf import settings
#from src.views import index
urlpatterns = [
#path('', index, name='index')
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
After leaving the pmkWebPdf.urls without the lines commented, i discovered that, in this file, if i leave the urlpatters empty and remove the from src.views import index
line. The server runs.
I've created the same proyect in both my desktop pc and my virtual machine following the same procedure and the result is different.
There are differences between the env The virtual machine must run on 32-bit. So the difference is that it runs python 3.5.2 vs 3.6.8 (the version of python in my desktop 64-bit pc). However, venv dependencies are exactly the same.
This is traceback of the error
Traceback (most recent call last):
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in check
for pattern in self.url_patterns:
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/hernan/pmk/pmkwebPdf/venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'pmkwebPdf.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.