Hello!


Django does not see application created with *django-admin startapp main*. 

./DjangoRestfulServer/
├── __init__.py
├── main
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-35.pyc
│   │   ├── __init__.cpython-35.pyc
│   │   ├── models.cpython-35.pyc
│   │   └── views.cpython-35.pyc
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── __pycache__
│   ├── __init__.cpython-35.pyc
│   ├── models.cpython-35.pyc
│   ├── settings.cpython-35.pyc
│   ├── urls.cpython-35.pyc
│   └── wsgi.cpython-35.pyc
├── settings.py
├── urls.py
└── wsgi.py



*settings.py*

...
INSTALLED_APPS = [
    ...
    'DjangoRestfulServer',
    'DjangoRestfulServer.main',
]
...

*main/urls.py*

from django.conf.urls import url, includefrom django.urls import include, path, 
re_pathfrom . import views

urlpatterns = [
    re_path(r'^facebook/$', views.FacebookLogin.as_view(), name='fb_login'),
]

*urls.py*

from django.contrib import adminfrom django.urls import include, path, re_path

urlpatterns = [
    path('api/v1/admin/', admin.site.urls),
    path('api/v1/accounts/', include('allauth.urls')),
    path('api/v1/', include('main.urls')),  # <- path('api/v1/', 
include('DjangoRestfulServer.main.urls')) acts the same!!!
]

Traceback is the following:

(env3) artem@artem-inspirion:~/Projects/GoTogether/Server$ python3 manage.py 
checkTraceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/management/__init__.py",
 line 371, in execute_from_command_line
    utility.execute()
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/management/__init__.py",
 line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/management/base.py",
 line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/management/base.py",
 line 335, in execute
    output = self.handle(*args, **options)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/management/commands/check.py",
 line 65, in handle
    fail_level=getattr(checks, options['fail_level']),
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/management/base.py",
 line 364, in check
    include_deployment_checks=include_deployment_checks,
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/management/base.py",
 line 351, in _run_checks
    return checks.run_checks(**kwargs)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/checks/registry.py",
 line 73, in run_checks
    new_errors = check(app_configs=app_configs)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/checks/urls.py",
 line 40, in check_url_namespaces_unique
    all_namespaces = _load_all_namespaces(resolver)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/core/checks/urls.py",
 line 57, in _load_all_namespaces
    url_patterns = getattr(resolver, 'url_patterns', [])
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/utils/functional.py",
 line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/urls/resolvers.py",
 line 536, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/utils/functional.py",
 line 36, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/urls/resolvers.py",
 line 529, in urlconf_module
    return import_module(self.urlconf_name)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/importlib/__init__.py",
 line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/artem/Projects/GoTogether/Server/DjangoRestfulServer/urls.py", 
line 22, in <module>
    path('api/v1/', include('main.urls')),
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/site-packages/django/urls/conf.py",
 line 34, in include
    urlconf_module = import_module(urlconf_module)
  File 
"/home/artem/Projects/GoTogether/Server/env3/lib/python3.5/importlib/__init__.py",
 line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 944, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in 
_find_and_load_unlockedImportError: No module named 'main'

Could you tell why Django does not see 'main' application?

$ uname -a
Linux artem-inspirion 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) 
x86_64 GNU/Linux

$ python3 --version
Python 3.5.3

$ python3 ./manage.py --version
2.0.4

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/91f0b4aa-9b1b-4546-86e9-c00109337def%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to