Django server fails to start in Docker container - python

I have been trying to run an existing Wagtail/Vue implementation from https://github.com/hyshka/wagtail-vue-talk
I have gotten as far as installing Docker and setting up the containers, but when I try to run a Django server from container, it spits out the following code:
root#e7d407eba535:/app# django-admin.py runserver 0.0.0.0:8000
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 60, in execute
super().execute(*args, **options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 67, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 57, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 107, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/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 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_unlocked
ImportError: No module named 'wagtail_vue'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 329, in run_from_argv
connections.close_all()
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 220, in close_all
for alias in self:
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 214, in __iter__
return iter(self.databases)
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 147, in databases
self._databases = settings.DATABASES
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 57, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.5/dist-packages/django/conf/__init__.py", line 107, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/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 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_unlocked
ImportError: No module named 'wagtail_vue'
So far I have checked the settings and requirements files, reinstalled containers a bunch of times. This error is often related to PATH configuration or __init__.py files, but all of that seems to be in place. Installed packages in docker container also seem to be correct.
The other container for Frontend works correctly, and my friend doing the same actions on MacOS got everything to work (I am on Windows 10).
The only option that I can think of at the moment is to move everything to Linux virtual environment, but I would like to avoid that.

Closing this question, as I found the "solution" myself.
After reinstalling and re-configuring everything multiple times I gave up and installed Ubuntu along with Win10 (dual boot), where it worked just as intended.

Related

PyGraphViz isnt running with Django error when django is installed

Django is running into an issue where when I try to run the PyGraphViz manage.py script it errors when it tries to import django.core.management
Traceback (most recent call last):
File "/home/zoctavous/.local/lib/python3.8/site-packages/django/core/management/__init__.py", line 259, in fetch_command
app_name = commands[subcommand]
KeyError: 'graph_models'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./manage.py", line 21, in <module>
main()
File "./manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/zoctavous/.local/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/home/zoctavous/.local/lib/python3.8/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/zoctavous/.local/lib/python3.8/site-packages/django/core/management/__init__.py", line 266, in fetch_command
settings.INSTALLED_APPS
File "/home/zoctavous/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 92, in __getattr__
self._setup(name)
File "/home/zoctavous/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 79, in _setup
self._wrapped = Settings(settings_module)
File "/home/zoctavous/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 190, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'core'
nevermind that this module imports just fine when I open a python shell. I tried just pip install django and I can verify that it is in my venv.
Sort of at a loss.

PyCharm Django debug does not launch, while manage.py launches server perfectly

I am trying to debug Django project via PyCharm. While launching server with python manage.py runserver works perfectly, PyCharm's debug fails to start. Why can this happen?
Error traceback:
Traceback (most recent call last):
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\core\management\base.py", line 427, in run_from_argv
connections.close_all()
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\db\utils.py", line 212, in close_all
for alias in self:
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\utils\connection.py", line 73, in __iter__
return iter(self.settings)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\utils\functional.py", line 49, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\utils\connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\db\utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\utils\connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\conf\__init__.py", line 88, in __getattr__
self._setup(name)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\conf\__init__.py", line 75, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\19639729\Desktop\Projects\eed_monitoring\venv\lib\site-packages\django\conf\__init__.py", line 184, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Program Files\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'monitoring.monitoring'
python-BaseException

Raised Error when I run python manage.py in Django in linux vps

I've recently cloned my django project into a linux vps. I used python3.10 in my system but in vps I have python3.8 . Actually I installed all necessary packages for it and also created database. I have this error whenever I run commands start with python manage.py. Can any body help me to solve it? Maybe this error is for different python version?
It also raised the error ModuleNotFoundError: No module named 'mysite' but I have no idea where I defined 'mysite' module.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/dist-packages/django/core/management/commands/runserver.py", line 74, in execute
super().execute(*args, **options)
File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 448, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.8/dist-packages/django/core/management/commands/runserver.py", line 81, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 92, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 79, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 190, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mysite'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/dist-packages/django/core/management/base.py", line 415, in run_from_argv
connections.close_all()
File "/usr/local/lib/python3.8/dist-packages/django/utils/connection.py", line 84, in close_all
for conn in self.all(initialized_only=True):
File "/usr/local/lib/python3.8/dist-packages/django/utils/connection.py", line 76, in all
return [
File "/usr/local/lib/python3.8/dist-packages/django/utils/connection.py", line 73, in __iter__
return iter(self.settings)
File "/usr/local/lib/python3.8/dist-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.8/dist-packages/django/utils/connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "/usr/local/lib/python3.8/dist-packages/django/db/utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
File "/usr/local/lib/python3.8/dist-packages/django/utils/connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 92, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 79, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 190, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mysite'

Anaconda does not execture Python command

I am having problems with Anaconda when trying to run the follwing command: python manage.py collectstatic
Does anybody know how to resolve the issue and what is the issue at all?
Here is the error message:
PS C:\Users\Dragan\heroku_workspace\python-getting-started> python manage.py collectstatic
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Dragan\Anaconda3\lib\site-Packages\django\core\management\__init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Users\Dragan\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Dragan\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 195, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Users\Dragan\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 40, in load_command_class
return module.Command()
File "C:\Users\Dragan\Anaconda3\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 32, in __init__
self.storage.path('')
File "C:\Users\Dragan\Anaconda3\lib\site-packages\django\utils\functional.py", line 204, in inner
self._setup()
File "C:\Users\Dragan\Anaconda3\lib\site-packages\django\contrib\staticfiles\storage.py", line 394, in _setup
self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
File "C:\Users\Dragan\Anaconda3\lib\site-packages\django\core\files\storage.py", line 328, in get_storage_class
return import_string(import_path or settings.DEFAULT_FILE_STORAGE)
File "C:\Users\Dragan\Anaconda3\lib\site-packages\django\utils\module_loading.py", line 20, in import_string
module = import_module(module_path)
File "C:\Users\Dragan\Anaconda3\lib\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
all_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_unlocked
ImportError: No module named 'whitenoise'

Django Project created in Eclipse (PyDev) runs out of command line, not out of Eclipse

I have created a Django Project in Eclipse. When I run manage.py from the commad line, it runs just fine, but when I run manage.py in Eclipse I get the Error Message below. The Project lives in an virtual environment that is stored at "C:\Users\Johanna\Envs\myproject\Scripts\python.exe".
Traceback (most recent call last):
File "C:\Users\Johanna\workspace\Hide and Seek Game\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Johanna\Envs\myproject\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Users\Johanna\Envs\myproject\lib\site-packages\django\core\management\__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "C:\Users\Johanna\Envs\myproject\lib\site-packages\django\conf\__init__.py", line 55, in __getattr__
self._setup(name)
File "C:\Users\Johanna\Envs\myproject\lib\site-packages\django\conf\__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\Johanna\Envs\myproject\lib\site-packages\django\conf\__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\Johanna\Envs\myproject\lib\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_unlocked
ImportError: No module named 'Hide and Seek Game'
I am happy for suggestions why this is the case.
I solved this problem by going to the project properties -> PyDev Django and setting the Django settings module.

Categories