Django Celery Start - python

I'm developing a Django app, using Celery and RabbitMQ as worker. I'm starting Celery with the following command (on Fedora)
python manage.py celery worker --loglevel=info
However, I'm getting the following error:
ImportError: No module named processe
In my office, we are using Ubuntu and are not getting any errors like this.
Here's the full traceback:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/djcelery/management/commands/celery.py", line 22, in run_from_argv
['%s %s' % (argv[0], argv[1])] + argv[2:],
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/bin/celery.py", line 901, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/bin/base.py", line 187, in execute_from_commandline
return self.handle_argv(prog_name, argv[1:])
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/bin/celery.py", line 893, in handle_argv
return self.execute(command, argv)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/bin/celery.py", line 868, in execute
return cls(app=self.app).run_from_argv(self.prog_name, argv)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/bin/celery.py", line 148, in run_from_argv
return self(*args, **options)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/bin/celery.py", line 118, in __call__
ret = self.run(*args, **kwargs)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/bin/celery.py", line 220, in run
return self.target.run(*args, **kwargs)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/bin/celeryd.py", line 141, in run
kwargs.get('pool_cls') or self.app.conf.CELERYD_POOL)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/celery/concurrency/__init__.py", line 26, in get_implementation
return symbol_by_name(cls, ALIASES)
File "/home/gurpinars/projects/github/Blog-Env/lib/python2.7/site-packages/kombu/utils/__init__.py", line 80, in symbol_by_name
module = imp(module_name, package=package, **kwargs)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named processes
Additionally, here is my pip freeze output:
Django==1.5.2
PIL==1.1.7
amqp==1.0.13
anyjson==0.3.3
billiard==2.7.3.32
celery==3.0.23
django-celery==3.0.23
django-debug-toolbar==0.9.4
ipdb==0.7
ipython==1.0.0
kombu==2.5.14
python-dateutil==2.1
pytz==2013d
redis==2.8.0
six==1.4.1
wsgiref==0.1.2
Any suggestions as to how I can resolve this issue?

Problem solved.On ubuntu,rabbitmq start automatically but fedora we had to start and restart manually when changed conf file.

Related

django.db.migrations.exceptions.NodeNotFoundError: Migration app.0172_auto_20220603_1746 dependencie _auto_20220601_2313')

I deleted some migration files that were giving me the error.
Then when I write "python3 manage.py showmigrations" I get the following error:
root#chat-manager:/var/www/jinabot# python3 manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 23, in <module>
main()
File "manage.py", line 19, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/__init__.py", line 419, in exe
utility.execute()
File "/usr/local/lib/python3.7/dist-packages/django/core/management/__init__.py", line 413, in exe
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 354, in run_fro
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/commands/makemigrations.py", l
loader = MigrationLoader(None, ignore_no_migrations=True)
File "/usr/local/lib/python3.7/dist-packages/django/db/migrations/loader.py", line 53, in __init__
self.build_graph()
File "/usr/local/lib/python3.7/dist-packages/django/db/migrations/loader.py", line 259, in build_g
self.graph.validate_consistency()
File "/usr/local/lib/python3.7/dist-packages/django/db/migrations/graph.py", line 195, in validate
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/usr/local/lib/python3.7/dist-packages/django/db/migrations/graph.py", line 195, in <listcom
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/usr/local/lib/python3.7/dist-packages/django/db/migrations/graph.py", line 58, in raise_err
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration app.0172_auto_20220603_1746 dependencie
_auto_20220601_2313')
How to fix it?
If you have such an error at the development stage, then I don’t know if this is correct, but I would probably delete all the migrations of the conflicting application and the database too, and then run "python manage.py makemigrations"
(Sorry, comments are not available to me)

Can't start test server with python django

I'm new to the Django framework and just trying to create a basic website, but when I try to open the server with the python manage.py runserver I get this error:
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 "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py", line 369, in execute
output = self.handle(*args, **options)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 601, in run_with_reloader
exit_code = restart_with_reloader()
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 230, in restart_with_reloader
p = subprocess.run(args, env=new_environ, close_fds=False)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\run\__init__.py", line 145, in __new__
process = cls.create_process(command, stdin, cwd=cwd, env=env, shell=shell)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\site-packages\run\__init__.py", line 121, in create_process
shlex.split(command),
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 310, in split
return list(lex)
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 299, in __next__
token = self.get_token()
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 109, in get_token
raw = self.read_token()
File "C:\Users\siuba\AppData\Local\Programs\Python\Python37\lib\shlex.py", line 140, in read_token
nextchar = self.instream.read(1)
AttributeError: 'list' object has no attribute 'read'
Does anyone know the answer? If so please help!
Thanks
Are you following a tutorial? If so, please share it with us. There may be a problem with your python installation. Please delete all python installations on your computer and install the latest version. Then create django project again.

I'm suddently not able to run server manage.py django since I upgrade my PyCharm

I can run server to test my webapp. Since I upgrade my PyCharm I cant run it.
I dont know how to do
Bellow is the error output
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 598, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 583, in start_django
reloader.run(django_main_thread)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 301, in run
self.run_loop()
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 307, in run_loop
next(ticker)
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 347, in tick
for filepath, mtime in self.snapshot_files():
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 363, in snapshot_files
for file in self.watched_files():
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 262, in watched_files
yield from iter_all_python_module_files()
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 103, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "C:\Users\migue\PycharmProjects\research4medjango\venv\lib\site-packages\django\utils\autoreload.py", line 139, in iter_modules_and_files
if not path.exists():
File "C:\Users\migue\AppData\Local\Programs\Python\Python35-32\lib\pathlib.py", line 1291, in exists
self.stat()
File "C:\Users\migue\AppData\Local\Programs\Python\Python35-32\lib\pathlib.py", line 1111, in stat
return self._accessor.stat(self)
File "C:\Users\migue\AppData\Local\Programs\Python\Python35-32\lib\pathlib.py", line 371, in wrapped
return strfunc(str(pathobj), *args)
OSError: [WinError 123] (File name, directory name or volume label syntax incorrect) when using __file__ '<frozen importlib._bootstrap>'

pserve development.ini --reload: fails in windows 10 64bit

I am following an article and creating my first project,
while i try the below command; the process gets into a loop and starts a server and kills it and again starts a server and kills and it keeps doing this continuously without breaking the loop and exiting.
pserve development.ini --reload
Below is the log
//---------------------------------------------------------
Starting monitor for PID 11912.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Others\Python\myBlog\lib\site-packages\hupper\ipc.py", line 322, in spawn_main
func(**kwargs)
File "D:\Others\Python\myBlog\lib\site-packages\hupper\worker.py", line 237, in worker_main
func(*spec_args, **spec_kwargs)
File "D:\Others\Python\myBlog\lib\site-packages\pyramid\scripts\pserve.py", line 32, in main
return command.run()
File "D:\Others\Python\myBlog\lib\site-packages\pyramid\scripts\pserve.py", line 229, in run
app = loader.get_wsgi_app(app_name, config_vars)
File "D:\Others\Python\myBlog\lib\site-packages\plaster_pastedeploy\__init__.py", line 131, in get_wsgi_app
global_conf=defaults)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 271, in loadobj
global_conf=global_conf)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 320, in _loadconfig
return loader.get_context(object_type, name, global_conf)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 450, in get_context
global_additions=global_additions)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 562, in _pipeline_app_context
for name in pipeline[:-1]]
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 562, in <listcomp>
for name in pipeline[:-1]]
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 406, in get_context
global_conf=global_conf)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 328, in _loadegg
return loader.get_context(object_type, name, global_conf)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 620, in get_context
object_type, name=name)
File "d:\others\python\myblog\lib\site-packages\paste\deploy\loadwsgi.py", line 646, in find_egg_entry_point
possible.append((entry.load(), protocol, entry.name))
File "D:\Others\Python\myBlog\lib\site-packages\pkg_resources\__init__.py", line 2405, in load
return self.resolve()
File "D:\Others\Python\myBlog\lib\site-packages\pkg_resources\__init__.py", line 2411, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "D:\Others\Python\myBlog\lib\site-packages\weberror-0.13.1-py3.6.egg\weberror\evalexception.py", line 127
except ValueError, ve:
^
SyntaxError: invalid syntax
Killing server with PID 11912.
Starting monitor for PID 4564.
Traceback (most recent call last):
It looks like the library you're trying to use isn't built for Python 3. The except SomeException, v: syntax is only valid in Python 2. In Python 3 you must use except SomeException as v:. Try running this with Python 2 or finding a newer version of this library that supports Python 3.
Python try...except comma vs 'as' in except

Upgrading to Django 1.11.4 ImportError

I'm attempting to upgrade Django from 1.10.7 to 1.11.4 with Python 2.7.11. I've run pip install Django -U and python -c "import django; print django.get_version()" confirms that Django 1.11.4 is installed. However, when I then go to run tests, I get ImportError: No module named notmigrations. Does anyone have any advice?
Here is the full stack trace:
Traceback (most recent call last):
File "./manage.py", line 25, in <module>
execute_from_command_line(sys.argv)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/commands/test.py", line 29, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/commands/test.py", line 62, in handle
failures = test_runner.run_tests(test_labels)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/test/runner.py", line 601, in run_tests
old_config = self.setup_databases()
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/test/runner.py", line 546, in setup_databases
self.parallel, **kwargs
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/test/utils.py", line 187, in setup_databases
serialize=connection.settings_dict.get('TEST', {}).get('SERIALIZE', True),
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 69, in create_test_db
run_syncdb=True,
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/__init__.py", line 130, in call_command
return command.execute(*args, **defaults)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 83, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__
self.build_graph()
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/migrations/loader.py", line 203, in build_graph
self.load_disk()
File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/migrations/loader.py", line 82, in load_disk
module = import_module(module_name)
File "/usr/local/lib/python2.7.11/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named notmigrations
It looks like you are using notmigrations in your MIGRATION_MODULES setting to disable migrations (as described in this post).
In Django 1.9+, you should simply use None instead of a fake module name like 'notmigrations' (release notes).
For Django 2.0 I create setting file as described here with content like:
from settings import *
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
MIGRATION_MODULES = DisableMigrations()
and run my tests with test newly created setting

Categories