I'm creating a soft AP in order to configure my raspberry wireless from it.
I alread have an script to create a hotspot, a dhcp server and now i need to run a django app using sudo.
(Yes, using sudo. I'm waking up my django server from my python script, and the script needs to run as sudo)
I'm getting the following error:
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/django/urls/conf.py", line 17, in include
urlconf_module, app_name = arg
ValueError: too many values to unpack (expected 2)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/commands/r unserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 395, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 382, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python3.7/dist-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python3.7/dist-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/usr/local/lib/python3.7/dist-packages/django/urls/resolvers.py", line 4 07, in check
for pattern in self.url_patterns:
File "/usr/local/lib/python3.7/dist-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.7/dist-packages/django/urls/resolvers.py", line 5 88, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.7/dist-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.7/dist-packages/django/urls/resolvers.py", line 5 81, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/pi/Documents/berryAP/networkRegistration/networkRegistration/urls. py", line 19, in <module>
url(r'^admin/', include(admin.site.urls)),
File "/usr/local/lib/python3.7/dist-packages/django/urls/conf.py", line 27, in include
'provide the namespace argument to include() instead.' % len(arg)
django.core.exceptions.ImproperlyConfigured: Passing a 3-tuple to include() is n ot supported. Pass a 2-tuple containing the list of patterns and app_name, and p rovide the namespace argument to include() instead.
When i run the server without sudo, it works as well.
How can i fix it to run the server as sudo?
Check if sudo and the "normal" user have the same python and Django Version.