I used the Django Rest Framework cookiecutter available here to scaffold a project. I've made no changes aside from setting up a virtualenv, installing requirements, and running pip install graphene_django. However, when I add graphene_django to the INSTALLED_APPS I receive the following error when attempting to run the server:
ModuleNotFoundError: No module named graphene_django
Any ideas why?
Traceback:
Traceback (most recent call last):
File "manage.py", line 24, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
django.setup()
File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
Pip freeze:
...
graphene-django==2.0.0
...
Command to run app:
docker-compose up
The issue seems be related to Docker (or more specifically, me being unfamiliar with Docker). Running the docker-compose up --build command solved the issue. Hopefully, that helps someone else!
Related
I'm trying to create migrations for my pet project.
However, I'm experiencing an Error that can't google an answer for:
it says:
`vincent#master-PC:/media/vincent/82944C77944C6FA9/Users/Ghost/Desktop/Python/PB/lesson 40/meeting_planner$ python3 manage.py makemigrations
Traceback (most recent call last):
File "/media/vincent/82944C77944C6FA9/Users/Ghost/Desktop/Python/PB/lesson 40/meeting_planner/manage.py", line 22, in <module>
main()
File "/media/vincent/82944C77944C6FA9/Users/Ghost/Desktop/Python/PB/lesson 40/meeting_planner/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/vincent/.local/share/virtualenvs/lesson_40-49hQCJIK/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/home/vincent/.local/share/virtualenvs/lesson_40-49hQCJIK/lib/python3.10/site-packages/django/core/management/__init__.py", line 420, in execute
django.setup()
File "/home/vincent/.local/share/virtualenvs/lesson_40-49hQCJIK/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/vincent/.local/share/virtualenvs/lesson_40-49hQCJIK/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/vincent/.local/share/virtualenvs/lesson_40-49hQCJIK/lib/python3.10/site-packages/django/apps/config.py", line 193, in create
import_module(entry)
File "/usr/lib/python3.10/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 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django.contrib.cont enttypes'
P.S. I'm using SQLite database
I DID define my app in the settings correctly (checked it twice), tried to restart my VScode and restart pipenv too. However, it didn't work.
django.contrib.cont enttypes should be django.contrib.contenttypes
i'm running into a very weird error in django rest framework. I tried all the solutions proposed in stackoverflow but nothing.
the error:
Traceback (most recent call last):
File "C:\Users\User\Desktop\IVAN.ru\IVAN_backend\backend\manage.py", line 22, in <module>
main()
File "C:\Users\User\Desktop\IVAN.ru\IVAN_backend\backend\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\User\Desktop\IVAN.ru\IVAN_backend\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\User\Desktop\IVAN.ru\IVAN_backend\lib\site-packages\django\core\management\__init__.py", line 395, in execute
django.setup()
File "C:\Users\User\Desktop\IVAN.ru\IVAN_backend\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\User\Desktop\IVAN.ru\IVAN_backend\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\User\Desktop\IVAN.ru\IVAN_backend\lib\site-packages\django\apps\config.py", line 224, in create
import_module(entry)
File "C:\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'imagekit'
please notice that i added 'imagekit' to installed apps , I uninstalled and reinstalled everything.
but nothing worked for me. I installed django-imagekit and uninstalled Imagekit.
i tried to replace 'imagekit' with 'Imagekit' .
Install django-imagekit:
pip install django-imagekit
Use ImageKit in settings.py file:
INSTALLED_APPS = [
"ImageKit"
...
]
I am very new to python and linux, I was trying to create an app from a tutorial and this happend when I tried to run a test of my model.
(venv) kali#kali:~/machinelearning/backend/server$ python manage.py test apps.ml.tests
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/kali/machinelearning/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
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 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'apps.endpointsapps'
This is my first question on stackoverflow too
Please add empty __init__.py file in the apps folder so that it can be recognized by Python as a package.
Check this link out. link
Can you please post the project structure you have? Basically just want to see where that apps exists.
You need to add an empty init.py (4 underscores in total) file in the apps folder for it to be recognized by Python as a package.
Have a look at the documentation for more informations.
I have this new remote job, where I had to clone all the code from a repository, and I have to make an export of the database from MySQL hosted in RDS.
The first problem is that when I set up the configuration to start the app, it raise an error telling me this:
Run Configuration Error: Broken configuration due to unavailable plugin or invalid configuration data.
The other thing is that I already have the data dumped and set up in my local storage (the app works this way, is no longer using AWS Cloud) but when I try to do an python manage.py migrate , this error comes up...
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
utility.execute()
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\core\management\__init__.py", line 312, in execute
django.setup()
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\apps\config.py", line 86, in create
module = import_module(entry)
File "C:\Users\Tony-App\AppData\Local\Programs\Python\Python37-32\lib\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 "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\liststyle\__init__.py", line 1, in <module>
from admin import ListStyleAdminMixin
ModuleNotFoundError: No module named 'admin'
First, django-liststyle is a dependency in your project, so make sure it has been installed.
py -m pip install django-liststyle
Second, make sure to add that package to INSTALLED_APPS:
INSTALLED_APPS = {
...
'liststyle',
...
'django.contrib.admin',
...
}
Third, I think the error you are getting is because of the way you are importing ListStyleAdminMixin. This should be the correct way to import it:
from liststyle.admin import ListStyleAdminMixin
I'm getting the following error stack when trying to issue a "django-admin migrate" command:
Traceback (most recent call last):
File "/usr/bin/django-admin", line 21, in <module>
management.execute_from_command_line()
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/lib/python3/dist-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/lib/python3/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/lib/python3/dist-packages/django/apps/config.py", line 87, in create
module = import_module(entry)
File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'tastypie'
When a run pip list, django-tastypie (0.12.1) is listed.
Anyone knows why django cannot find this module?
Thanks in advance!
Add tastypie to INSTALLED_APPS in your project's settings.py file:
INSTALLED_APPS = (
...
...
'tastypie',
)