I am currently making a django application that requires me to add Bower and django-schedule library. When i try to make migrations, I get this error:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 347, in execute
django.setup()
File "C:\Python34\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python34\lib\site-packages\django\apps\registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "C:\Python34\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\Python34\lib\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 'djangobower'
my settings.py consists of:
INSTALLED_APPS = [
'patients.apps.PatientsConfig',
'accounts.apps.AccountsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'djangobower',
'schedule',
]
BOWER_COMPONENTS_ROOT = 'Project root/components/'
BOWER_INSTALLED_APPS = (
'jquery',
'jquery-ui',
'bootstrap',
'fullcalendar'
)
i am using pycharm as my IDE and in bower apps, it shows jquery-ui and fullcalendar as unresolved, even though I have installed them. Any help is appreciated.
It seems like bower isnt really installed check that by pip list.
If it is so did you do ./manage.py bower install ?
I think you should have the PROJECT_ROOT variable set somewhere in your settings.py file.
BOWER_COMPONENTS_ROOT = 'Project root/components/'
should be something like
BOWER_COMPONENTS_ROOT = os.path.join(PROJECT_ROOT, 'components')
In my case the variable in the latest Django install was BASE_DIR
Related
I am starting out in django-cms and I am trying to install cms from the official cms documentation. I created my virtual environment and installed Django and django-cms.
The next steps are to create a project with django-admin, and adding the django-cms in the installed apps. The project is going great till now. But, when I try to migrate my installed apps in the database I get the error "No module named 'packaging'". I don't understand what I am doing wrong. Another tutorial tells me to startproject using djangocms myproject
but it doesn't work (it's probably outdated as I couldn't find any variations anywhere else)
My settings.py:
INSTALLED_APPS = [
'djangocms_admin_style',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'cms',
'menus',
'treebeard',
]
SITE_ID = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
LANGUAGE_CODE = 'en'
LANGUAGES = [
('en', 'English'),
]
After this, I run the
py manage.py makemigrations
But I get the error
Traceback (most recent call last):
File "E:\art\Graphic Design\Coding\law-&-stuff\myproject\manage.py", line 22, in <module>
main()
File "E:\art\Graphic Design\Coding\law-&-stuff\myproject\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\django\core\management\__init__.py", line 420, in execute
django.setup()
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\django\apps\registry.py", line 116, in populate
app_config.import_models()
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\django\apps\config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\cms\models\__init__.py", line 4, in <module>
from .placeholdermodel import * # nopyflakes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\cms\models\placeholdermodel.py", line 14, in <module>
from cms.utils import get_language_from_request, get_site_id, permissions
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\cms\utils\permissions.py", line 13, in <module>
from cms.utils.compat.dj import available_attrs
File "E:\art\Graphic Design\Coding\law-&-stuff\venv\Lib\site-packages\cms\utils\compat\__init__.py", line 4, in <module>
from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'
I am following the documentation from https://docs.django-cms.org/en/latest/how_to/install.html. I think it might have something to do with how the packages have been installed? But, I don't understand how to fix it.
Found the solution!
The packaging module was not installed by default, I upgraded my pip with py -m pip install --upgrade pip and installed the module with py -m pip install packaging and it works now.
I'm following a Tech with Tim tutorial https://www.youtube.com/watch?v=JD-age0BPVo&list=PLzMcBGfZo4-kCLWnGmK0jUBmGLaJxvi4j&index=1&t=373s, and when I try run makemigrations I keep getting the error ModuleNotFoundError: No module named ‘api.app’
Upon executing the command in the terminal, I received this error.
ryanmg#Ryans-MacBook-Pro music_controller % python3 manage.py makemigrations
Traceback (most recent call last):
File "/Users/ryanmg/Documents/Coding/React-Django-Project/music_controller/manage.py", line 22, in <module>
main()
File "/Users/ryanmg/Documents/Coding/React-Django-Project/music_controller/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 420, in execute
django.setup()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/apps/config.py", line 213, in create
mod = import_module(mod_path)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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 'api.apps'
This is my settings.py file. I have added the reference "api.apps.ApiConfig"
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'api.apps.ApiConfig',
'rest_framework',
]
This is my apps.py file
from django.apps import AppConfig
class ApiConfig(AppConfig):
# default_auto_field = 'django.db.models.BigAutoField'
name = 'api'
My directory listings are as follows
image of directory listings
I want to update my heroku site with this command heroku run python manage.py migrate, but the error appeared:
» Warning: heroku update available from 7.53.0 to 7.60.2.
Running python manage.py migrate on ⬢ mighty-harbor-18334... up, run.5980 (Free)
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 401, in execute
django.setup()
File "/app/.heroku/python/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/app/.heroku/python/lib/python3.10/site-packages/django/apps/config.py", line 223, in create
import_module(entry)
File "/app/.heroku/python/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_apscheduler'
I installed django_apscheduler with pip install django_apscheduler for sure. My python version is 3.10.2, and in my settings.py, the app module is in INSTALLED_APPS such:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp'
'django_apscheduler',
]
I am not sure why the ModuleNotFoundError would occured, any help will be appreciated.
You forgot after 'myapp' put a comma in INSTALLED_APPS
I'm trying to learn Django channels, so for the beginning, I simply installed and added "channels" to the Django project, INSTALLED_APPS in the settings.py, as showing below.
Installed channels with pip:
pip install channels
Installed versions:
channels 3.0.3
daphne 3.0.1
Django 2.2.13
settings.py > INSTALLED_APPS:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
...
'django_ace',
'channels', # added this
]
I just installed one package and added one line to the settings.py so this shouldn't be an error, but when I try to run the server python .\source\manage.py runserver I got an error as showing below.
> python .\source\manage.py runserver --noreload
Traceback (most recent call last):
File ".\source\manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\django\core\management\__init__.py", line 357, in execute
django.setup()
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "c:\python37\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:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\channels\apps.py", line 4, in <module>
import daphne.server
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\daphne\server.py", line 32, in <module>
from .ws_protocol import WebSocketFactory
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\daphne\ws_protocol.py", line 6, in <module>
from autobahn.twisted.websocket import (
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\autobahn\twisted\__init__.py", line 40, in <module>
from autobahn.twisted.websocket import \
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\autobahn\twisted\websocket.py", line 42, in <module>
from autobahn.util import public
File "C:\pg\django\win\simple-django-login-and-register\venv\lib\site-packages\autobahn\util.py", line 464, in <module>
_ = _rtime() # this starts wallclock
DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
I did google and seems it's not version compatibility issue between django and channels, what's wrong with my project?
(added)
I tried pip install pypiwin32 seeing Error after adding Django channels to installed_apps in settings file - Stack Overflow, but it didn't solve anything, and stil the same error.
I am trying to upgrade my Django project to Django 2.0, currently the version is 1.8.19. I figured I would do it step by step, firstly upgrading to 1.9, then 1.10 and so on till 2.0. The problem is that I get error message
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/riddle/tmp1/example-project/env/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 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/riddle/tmp1/example-project/app/ad_akumuliatoriai_lt/settings.py", line 140, in <module>
from apps.frontend.ad_akumuliatoriai.models import Language
File "/home/riddle/tmp1/example-project/app/apps/frontend/ad_akumuliatoriai/models.py", line 5, in <module>
from ordered_model.models import OrderedModel
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/ordered_model/models.py", line 20, in <module>
class OrderedModelBase(models.Model):
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/django/db/models/base.py", line 94, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
self.check_apps_ready()
File "/home/riddle/tmp1/example-project/env/lib/python3.6/site-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
I have read the thread: Django upgrading to 1.9 error "AppRegistryNotReady: Apps aren't loaded yet."
I have tried using
import django
django.setup()
at the top of my settings.py file with no luck.
I've made an assumption that the problem is with the third party apps.
My main question is, how to start checking for invalid third party apps, since commenting them out one by one does not remove the error. I've checked every app's that I've installed via pip documentation, and added the required lines
to the INSTALLED_APPS in settings.py. It seems that some packages, such as django-jquery, django-libsass, django-ordered-model have not been developed for some years, however, according to django==1.9 release date, those apps should have worked on django==1.9 (or maybe that is the mistake of my thinking?).
I am ready to post more information from my project if needed.
My settings.py fragment:
INSTALLED_APPS = (
'hvad',
'compressor',
'filebrowser',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'jquery',
'tinymce',
'apps.frontend.ad_akumuliatoriai',
'ordered_model',
'geoposition',
)
The output of "pip freeze":
Django==1.9
django-appconf==1.0.2
django-compressor==2.2
django-filebrowser-no-grappelli==3.7.4
django-geoposition==0.3.0
django-hvad==1.8.0
django-jquery==3.1.0
django-libsass==0.7
django-ordered-model==1.4.3
django-tinymce==2.7.0
libsass==0.14.2
Pillow==5.1.0
psycopg2==2.7.4
pytz==2018.3
rcssmin==1.0.6
rjsmin==1.0.12
six==1.11.0
The traceback suggests you are importing a model in your settings.py:
from apps.frontend.ad_akumuliatoriai.models import Language
You shouldn't do this. Remove the import.