Celery issue in a kubernetes pod - django

While trying to create a super user for this application using manage.py I am getting the following error.
root#taiga-back-675fcdbd67-rx552:/taiga-back# ./manage.py createsuperuser
Username: testuser
Email address: testuser#abc.com
Password:
Password (again):
Traceback (most recent call last):
File "/opt/venv/lib/python3.7/site-packages/kombu/utils/functional.py", line 30, in __call__
return self.__value__
AttributeError: 'ChannelPromise' object has no attribute '__value__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/venv/lib/python3.7/site-packages/amqp/transport.py", line 173, in _connect
host, port, family, socket.SOCK_STREAM, SOL_TCP)
File "/usr/local/lib/python3.7/socket.py", line 752, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname
This is the CELERY Configuration. Sorry, it's Nano
This application running as a pod in a Kubernetes cluster. I searched for this but could not find anything meaningful to begin troubleshooting. Any hints/answer would help.

Related

Can't install django-mailgun

I want to install django-mailgun library. Followed this tutorial https://learnbatta.com/blog/django-send-email-using-mailgun-api-94/
I tried
pip install django-mailgun --verbose
Log of command:
Using pip 21.0.1 from /home/alex/.local/lib/python3.6/site-packages/pip (python 3.6)
Defaulting to user installation because normal site-packages is not writeable
Created temporary directory: /tmp/pip-ephem-wheel-cache-r4kdc56j
Created temporary directory: /tmp/pip-req-tracker-s1r35ye8
Initialized build tracking at /tmp/pip-req-tracker-s1r35ye8
Created build tracker: /tmp/pip-req-tracker-s1r35ye8
Entered build tracker: /tmp/pip-req-tracker-s1r35ye8
Created temporary directory: /tmp/pip-install-14dd83we
1 location(s) to search for versions of django-mailgun:
* https://pypi.org/simple/django-mailgun/
Fetching project page and analyzing links: https://pypi.org/simple/django-mailgun/
Getting page https://pypi.org/simple/django-mailgun/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/django-mailgun/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/django-mailgun/ HTTP/1.1" 404 13
Status code 404 not in (200, 203, 300, 301)
Could not fetch URL https://pypi.org/simple/django-mailgun/: 404 Client Error: Not Found for url: https://pypi.org/simple/django-mailgun/ - skipping
Given no hashes to check 0 links for project 'django-mailgun': discarding no candidates
ERROR: Could not find a version that satisfies the requirement django-mailgun
ERROR: No matching distribution found for django-mailgun
Exception information:
Traceback (most recent call last):
File "/home/alex/.local/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 171, in _merge_into_criterion
crit = self.state.criteria[name]
KeyError: 'django-mailgun'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/alex/.local/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 318, in resolve
name, crit = self._merge_into_criterion(r, parent=None)
File "/home/alex/.local/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _merge_into_criterion
crit = Criterion.from_requirement(self._p, requirement, parent)
File "/home/alex/.local/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 83, in from_requirement
raise RequirementsConflicted(criterion)
pip._vendor.resolvelib.resolvers.RequirementsConflicted: Requirements conflict: SpecifierRequirement('django-mailgun')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/alex/.local/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
requirements, max_rounds=try_to_avoid_resolution_too_deep,
File "/home/alex/.local/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 453, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/home/alex/.local/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 320, in resolve
raise ResolutionImpossible(e.criterion.information)
pip._vendor.resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=SpecifierRequirement('django-mailgun'), parent=None)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/alex/.local/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
status = self.run(options, args)
File "/home/alex/.local/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 178, in wrapper
return func(self, options, args)
File "/home/alex/.local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 317, in run
reqs, check_supported_wheels=not options.target_dir
File "/home/alex/.local/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 127, in resolve
six.raise_from(error, e)
File "<string>", line 3, in raise_from
pip._internal.exceptions.DistributionNotFound: No matching distribution found for django-mailgun
Removed build tracker: '/tmp/pip-req-tracker-wgh79mc3'
OS -- Ubuntu 16.04 LTS
That command is wrong, you need to follow the official command: pip install django-mailgun-mime

google_app_engine runtime process for the instance running on port 46765 has unexpectedly quit

I have successfully installed on Ubuntu digital ocean server but it's automatically close in time interval after 1 or 2 days and need to start again and again on server
i have check process on 8000 port is running but on server 8080 its is not working
error was port close unexpectedly. I am attach Error image so understand you can understand easily.
Error:
the runtime process for the instance running on port 46765 has unexpectedly quit
ERROR 2019-11-28 05:52:48,879 base.py:209] Internal Server Error: /input/
Traceback (most recent call last):
File "/var/www/html/sym_math/google_appengine/lib/django-1.3/django/core/handlers/base.py", line 178, in get_response
response = middleware_method(request, response)
File "/var/www/html/sym_math/google_appengine/lib/django-1.3/django/middleware/common.py", line 94, in process_response
if response.status_code == 404:
AttributeError: 'tuple' object has no attribute 'status_code'
ERROR 2019-11-28 14:25:50,789 base.py:209] Internal Server Error: /input/
Traceback (most recent call last):
File "/var/www/html/sym_math/google_appengine/lib/django-1.3/django/core/handlers/base.py", line 178, in get_response
response = middleware_method(request, response)
File "/var/www/html/sym_math/google_appengine/lib/django-1.3/django/middleware/common.py", line 94, in process_response
if response.status_code == 404:
AttributeError: 'tuple' object has no attribute 'status_code'

Connect to Django test database

Is there a way to connect to django test database using connections?
I have tried
cursor = connections['test_name_of_main_db'].cursor()
and also specified the test db name in settings but I still receive errors:
Traceback (most recent call last):
File "/home/tets/4d/lib/python3.5/site-packages/django/db/utils.py", line 176, in ensure_defaults
conn = self.databases[alias]
KeyError: 'auto_tests'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tets/healthware_server/component/medical/tests.py", line 72, in test_model_observation
cursor = connections['auto_tests'].cursor()
File "/home/tets/4d/lib/python3.5/site-packages/django/db/utils.py", line 208, in __getitem__ self.ensure_defaults(alias)
File "/home/tets/4d/lib/python3.5/site-packages/django/db/utils.py", line 178, in ensure_defaults
raise ConnectionDoesNotExist("The connection %s doesn't exist" % alias)
django.db.utils.ConnectionDoesNotExist: The connection auto_tests doesn't exist
According to the docs:
The default test database names are created by prepending test_ to the value of each NAME in DATABASES.
But in your stacktrace the error says:
django.db.utils.ConnectionDoesNotExist: The connection auto_tests doesn't exist
Are you sure you are using the right alias? According to the error, it is looking for a database named auto_tests.
As another debugging step, you could print all the aliases during the test to see which ones are available
for alias in connections:
print(alias)
Of course, you could also try to use the default database and see if that works for you during the tests:
# note that it is 'connection' and not 'connections'
from django.db import connection
cursor = connection.cursor()

pyhs2 error connective to kerberos enabled hive

I am trying to connect to hive using python 2(miniconda2 installation ).
Below is the code I am trying-
connection = hive.connect(host='psvlxihpnn1', port= '10000', authMechanism='KERBEROS', user='***',password='****', configuration={'krb_host': 'psvlxihpnn1', 'krb_service': 'ITEDM'} )
kerberos host is installed on the same host machine and has service name 'ITEDM'
Strangely, I am getting below error-
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/export/home/itedm/miniconda2/lib/python2.7/site-packages/pyhs2-0.6.0-py2.7.egg/pyhs2/__init__.py", line 7, in connect
File "/export/home/itedm/miniconda2/lib/python2.7/site-packages/pyhs2-0.6.0-py2.7.egg/pyhs2/connections.py", line 46, in __init__
File "/export/home/itedm/miniconda2/lib/python2.7/site-packages/pyhs2-0.6.0-py2.7.egg/pyhs2/cloudera/thrift_sasl.py", line 66, in open
thrift.transport.TTransport.TTransportException: Could not start SASL: Error in sasl_client_start (-1) SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Server krbtgt/INFORMATICA.COM#ITEDM not found in Kerberos database)
I am not passing 'krbtgt' as user, not sure why this error is coming.
Thanks for any help.
This connection string will work as long as the user running the script has a valid kerberos ticket:
import pyhs2
with pyhs2.connect(host='beeline_host',
port=10000,
authMechanism="KERBEROS") as conn:
with conn.cursor() as cur:
print cur.getDatabases()
Username, password and any other configuration parameters are not passed through the KDC.

Gunicorn NameError: global name 'fileno' is not defined

I'm working on a Django app with gunicorn right now. Everything has been working for the past couple months but today, when I tried to deploy my latest changes to my dev server, I got this error when I tried to access it:
Traceback (most recent call last):
File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 130, in handle
self.handle_request(listener, req, client, addr)
File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 174, in handle_request
resp.write_file(respiter)
File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 396, in write_file
if not self.sendfile(respiter):
File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 360, in sendfile
offset = os.lseek(fileno, 0, os.SEEK_CUR)
NameError: global name 'fileno' is not defined
Gunicorn command:
gunicorn --bind 0.0.0.0:8000 --pythonpath server base.wsgi_django:application
I have been unable to find anything about this online and have absolutely no idea what I did to cause this error. If anyone has any ideas, please let me know!
UPDATE
When running my server in debug mode, I get this error instead, and it shows up many more times:
Traceback (most recent call last):
File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/django/views/static.py", line 54, in serve
fullpath = os.path.join(document_root, newpath)
File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/posixpath.py", line 77, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
I'm having the exact same issue with a Flask app. Turns out it is a bug in Gunicorn 19.4.4. Downgrading to 19.4.3 solves the problem for me.
Reporting it upstream.