no module name 'celery' after migrate - python

I have been following tutorial how to import celery and run rabbitmq to my django project. and I have been following a tutorial on youtube. I do not now what I have missed but after the part where i ran python manage.py migrate djcelery it gives the result of:
root#1095ea233e7b:/app/main# python3 manage.py migrate djcelery
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py", line 302, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 55, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py", line 99, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
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 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/app/main/actinbox/settings.py", line 6, in <module>
import djcelery
this is the tutorial that I have been following:
Django Celery Part 1

As I said in a comment, it's probably because you installed celery 4.0.0.
the tutorial you followed uses celery 3.0.23.
If you really want to use the tutorial use pip install django-celery==3.0.23
this is not recommended because it's an outdated version.

Related

While running a project from Git on my pycharm, showing some error

Every Django project that I'm trying from git is showing the same error. Although I install all the requirements it is still showing error while I try to run the server.
This is the command which I try to execute:
And this is the final error:
And here is the error.
G:\Study\Python\Django Project\Airline-reservation-django-master>py manage.py makemigration
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line
utility.execute()
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\core\management\__init__.py", line 341, in execute
django.setup()
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models(all_models)
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\apps\config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\vivek\Python\Python38-32\lib\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 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "G:\Study\Python\Django Project\Airline-reservation-django-master\Airline\models.py", line 2, in <module>
from django.contrib.auth.models import User
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\contrib\auth\models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\vivek\Python\Python38-32\lib\site-packages\django\contrib\auth\base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
RuntimeError: __class__ not set defining 'AbstractBaseUser' as <class 'django.contrib.auth.base_user.AbstractBaseUser'>. Was __classcell__ propagat
ed to type.__new__?
it is because it provide its own virtual environment and in that environment not all the requirements install try to install all the requirements again to solve this problem from pycharm
the only thing you have to do is you have to specify your python interpreter and install your require software on that

ModuleNotFoundError: No module named 'snowpenguin'

(venv) E:\Studia Materialy\Semestr 4\IO\l02-nr-6-cyber-mechanik-l02team- master>python manage.py makemigrations L02
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\keray\venv\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\keray\venv\lib\site-packages\django\core\management\__init__.py", line 357, in execute django.setup()
File "C:\Users\keray\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\keray\venv\lib\site-packages\django\apps\registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "C:\Users\keray\venv\lib\site-packages\django\apps\config.py", line 116, in create
mod = import_module(mod_path)
File "E:\Programowanie\Python\lib\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 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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
ModuleNotFoundError: No module named 'snowpenguin'
Can't run python manage.py runserver because of this problem, python 3.7, Django 2.0.7. I have tried many versions of python, and Django, I have also reinstalled bootstrap.
For me, I had to download django-recaptcha versions 2 & 3. Might be different for you though. Just follow #Lemayzeur's comment and look in your INSTALLED_APPS to find out what to download via pip.

python manage.py migrate: No module named 'muypicky.base'

Background: I'm taking a beginners Django course and I've run into an issue. The following command isn't working in Terminal.
Running on Mac
Virtual environment
Taking UDEMY Course: try-django-v1-11-python-web-development
Command: python manage.py migrate
Terminal Output:
(trydjango1-11) C02T74CKGTF1:src josh.frazier$ python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/josh.frazier/Dev/trydjango1-11/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/Users/josh.frazier/Dev/trydjango1-11/lib/python3.6/site-packages/django/core/management/__init__.py", line 307, in execute
settings.INSTALLED_APPS
File "/Users/josh.frazier/Dev/trydjango1-11/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/Users/josh.frazier/Dev/trydjango1-11/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/Users/josh.frazier/Dev/trydjango1-11/lib/python3.6/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/Users/josh.frazier/Dev/trydjango1-11/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 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 "/Users/josh.frazier/Dev/trydjango1-11/src/muypicky/__init__.py", line 1, in <module>
from .base import *
ModuleNotFoundError: No module named 'muypicky.base'
After going through your files, i found that you haven't imported local.py and production.py in your __init__.py add the following code to __init__.py file inside settings folder
from .base import *
from .production import *
try:
from .local import *
except:
pass

Django 1.8 psycopg2 import error

I have psycopg2 installed on my computer under C:\Python34\Lib\site-packages\psycopg2
If I use a postgresql database in a django project outside a virtual environment, I get no error.But, when I want to transfer the project to a virtual env so that I can deploy it on heroku. But when I try to migrate the database I get an error saying psycopg2 module is not present. I even tried to install it inside the virtual env using pip install psycopg2 and even that didn't work. Here is the full traceback.
(denv) C:\Users\Saket\denv\musicalguru>python manage.py migrate
Traceback (most recent call last):
File "C:\Users\Saket\denv\lib\site- packages\django\db\backends\postgresql_psycopg2\base.py", line 20, in <module>
import psycopg2 as Database
File "C:\Users\Saket\denv\lib\site-packages\psycopg2\__init__.py", line 50, in<module>from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Saket\denv\lib\sitepackages
\django\core\management\__init__.py", line 338, in execute_from_command_line
utility.execute()
File "C:\Users\Saket\denv\lib\site- packages\django\core\management\__init__.py", line 312, in execute
django.setup()
File "C:\Users\Saket\denv\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Saket\denv\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models(all_models)
File "C:\Users\Saket\denv\lib\site-packages\django\apps\config.py", line 198,in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Saket\denv\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 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Users\Saket\denv\lib\site- packages\django\contrib\auth\models.py", line 41, in <module>
class Permission(models.Model):
File "C:\Users\Saket\denv\lib\site-packages\django\db\models\base.py", line 139, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "C:\Users\Saket\denv\lib\site-packages\django\db\models\base.py", line 324, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\Saket\denv\lib\site-packages\django\db\models\options.py", line 250, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Users\Saket\denv\lib\site-packages\django\db\__init__.py", line 36, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Users\Saket\denv\lib\site-packages\django\db\utils.py", line 240, in__getitem__
backend = load_backend(db['ENGINE'])
File "C:\Users\Saket\denv\lib\site-packages\django\db\utils.py", line 111, in
load_backend
return import_module('%s.base' % backend_name)
File "C:\Users\Saket\denv\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 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Users\Saket\denv\lib\sitepackages\django\db\backends\postgresql_psyc
opg2\base.py", line 24, in <module>
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: DLL
load failed: The specified module could not be found.
I used the instructions to install in virtual env from here
And then added PostgreSQL's 'bin' directory on the system path. That seemed to do the trick.
Intalling psycopg2 from source into virtualenv under windows is a pain.
Instead you can create the virtualenv that have access to system wide installed packages.
virtualenv --system-site-packages env_dir

python3.3 manage.py syncdb syntax error

Very new to Django - I'm trying to get a site set up on Webfaction using their guide. http://docs.webfaction.com/software/django/getting-started.html
I've updated settings.py as instructed but I'm getting a syntax error in my settings.py file. I've tried going through and making sure there are no tabs and just spaces.
Here's the error message:
python3.3 manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/bstolte/webapps/mo_detector/lib/python3.3/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/bstolte/webapps/mo_detector/lib/python3.3/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/bstolte/webapps/mo_detector/lib/python3.3/django/core/management/__init__.py", line 261, in fetch_command
commands = get_commands()
File "/home/bstolte/webapps/mo_detector/lib/python3.3/django/core/management/__init__.py", line 107, in get_commands
apps = settings.INSTALLED_APPS
File "/home/bstolte/webapps/mo_detector/lib/python3.3/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/home/bstolte/webapps/mo_detector/lib/python3.3/django/conf/__init__.py", line 49, in _setup
self._wrapped = Settings(settings_module)
File "/home/bstolte/webapps/mo_detector/lib/python3.3/django/conf/__init__.py", line 128, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python3.3/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1586, in _gcd_import
File "<frozen importlib._bootstrap>", line 1567, in _find_and_load
File "<frozen importlib._bootstrap>", line 1534, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1024, in load_module
File "<frozen importlib._bootstrap>", line 1005, in load_module
File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 855, in _load_module
File "<frozen importlib._bootstrap>", line 982, in get_code
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/bstolte/webapps/mo_detector/mo_detector/mo_detector/settings.py", line 35
INSTALLED_APPS = (
^
SyntaxError: invalid syntax
Any ideas on why it's failing at INSTALLED_APPS?
Usually when you get a syntax error like that that's pointing at something you don't see any error with, it means there's an unclosed bracket, indentation block or other item preceding that in the file. The settings.py file follows normal Python syntax rules like any other .py file, so look for stuff preceding that line that might cause the parser to choke.

Categories

Resources