Failed to query Solr using '*:*': [Errno 111] Connection refused - django

Tried to integrate haystack 2.0.0-beta - solr with my django project for full text search, when i run the following
from haystack.query import SearchQuerySet
al = SearchQuerySet().all()
got an error
Failed to query Solr using '*:*': [Errno 111] Connection refused
How can i solve this issue?Thanks in advance.

Solr doesn't look to be running and you haven't given any details so:
Solr is a standalone process that needs to be started manually. Furthermore, it needs a servlet container to run within, normally jetty or tomcat which are both java based (discussion here and here). Depending on your machine, you need to install and start these before you get started with python or Django. If you are debian you can most likely do apt-get install solr-jetty and voila.
Once solr is installed, you need the bindings for python pysolr - pip install pysolr and django haystack pip install haystack==2.0.
There is a tutorial in the haystack documentation here, as well as a good blog post here about installing, starting and configuring the combination of solr, jetty, python and django.

Related

Using google-cloud-tasks with python 2.7 on app-engine

I'm working on migrating a Python 2.7/1st Gen/GAE app to Python 3/2nd Gen/GAE.
My current step is replacing google.appengine.ext.deferred with the Python Client for Cloud Tasks API.
Here is where I'm at:
Still using Python 2.7
Latest updates with gcloud components update
Following the Python Client docs, I added google-cloud-tasks==1.5.0 to my requirements.txt
google-cloud-tasks needs grpcio so I added - name: grpcio\n version: latest to app.yaml
Now dev_appserver.py is giving me the error ImportError: No module named enum
I'm not finding much documentation online so I'm wondering... Is it possible to use google-cloud-tasks with Python 2.7 on app engine?
If so, how do I fix the last error above?

uWSGI command not found

Background:
I am in the process of deploying a Django site and from my understanding and research, I needed to get a web server, a WSGI protocol interface to actually run said python code and 'communicate' with it, and lastly a reverse proxy server to tie the two together and pass HTTP requests through the pipeline to Django. (By virtue of my install method, mod_wsgi is not an option thanks to EasyApache4 and cPanel so I cannot use the mod_wsgi sockets method)
My problem:
I have organized an apache 2 hosting server and managed to install mod_proxy and mod_proxy_uWSGI using the EasyApache4 auto installer. From what I understand, now I need to set up the proxy system to relay HTTP requests through mod_proxy_uWSGI which doubles up and also runs my Django site, however, I cannot access or configure mod_proxy_uWSGI. When I try using the following style command (sorry, I don't want my server URLs floating around the internet):
uwsgi --http :8000 --wsgi-file test.py
I get an error message:
bash: uwsgi: command not found
Am I missing something?
Thanks to a comment by [#dirkgroten]. To install UWSGI :
pip install uwsgi
After running pip install uwsgi, it's possible that uwsgi was installed someplace not on your PATH. IE, in my case, it got installed to:
/usr/local/opt/python-3.8.6/bin/uwsgi
I was able to fix this by adding a symlink:
sudo ln -s /usr/local/opt/python-3.8.6/bin/uwsgi /usr/bin/uwsgi
(This may be a terrible idea. It may be a much better idea to use a venv, but I'm following a tutorial that specifically told me to avoid using a venv.)
In my case, using Docker, I found the binary to be located in:
/home/webappuser/.local/bin
Adding to #ArtOfWarfare's answer, you can check where pip is installing your packages using this command.
▶ pip show uwsgi
Name: uWSGI
Version: 2.0.21
Summary: The uWSGI server
Home-page: https://uwsgi-docs.readthedocs.io/en/latest/
Author: Unbit
Author-email: info#unbit.it
License: GPLv2+
Location: /Users/username/Library/Python/3.9/lib/python/site-packages
Requires:
Required-by:
In my case, it is /Users/username/Library/Python/3.9/lib/python/site-packages. So the uwsgi binary will be present in /Users/username/Library/Python/3.9/bin/. Add this location to PATH and you should be good.

How to create a working JDBC connection in Google Cloud Composer?

To get the JDBC Hook working, I first add in the jaydebeapi package in the PYPI packages page in Composer.
However, that alone does not allow a JDBC connection to work:
1) How do I specify the .jar driver path for the JDBC driver I have?
I was thinking it would be something like "/home/airflow/gcs/drivers/xxx.jar" (assuming I've created a drivers folder in the gcs directory)... but I haven't been able to verify or find documentation on this.
2)How do I install/point toward the Java JRE? On Ubuntu I run this command to install JRE: sudo apt-get install default-jre libc6-i386. Is a JRE or ability to install a JRE available in Cloud Composer? This is the current error message I get in the Adhoc window with the JDBC connection: [Errno 2] No such file or directory: '/usr/lib/jvm'
If either of the above options are not currently available, are there any workarounds to get a JDBC connection working with Composer?
There are known issues with JDBC issues in Airflow 1.9 (https://github.com/apache/incubator-airflow/pull/3257); hopefully, we should be able to backport these fixes in Composer by GA!

Error with H20 - Python init(): Server Error

This is a totally newbie question to see if I am missing something key (like there is more to install?).
After installing H20 (python 2.7) on a 9 node Hadoop / Spark cluster
using pip install of the whl file (h2o-3.10.4.8-py2.py3-none-any.whl) (which says it installed correctly).....
I can import h2o successfully.
But, when I run h2o.init() then I get:
"Checking whether there is an H20 instance running at http://localhost:54321. connected."
But then an error is thrown:
H2oServerError: HTTP 500 Server Error: u'Error: 500'
Should I be able to run H20 by simply pip installing that whl or is there more? The documentation seems outdated and there are lots of different versions found online. Anyone have any experience with this?
It's most likely that you got this problem solved, but maybe someone else may benefit. Use the install in Python Tab on the following website : http://h2o-release.s3.amazonaws.com/h2o/rel-tutte/2/index.html.

webfaction hosted django app, shopify module will not import

I've recently created a site with a django app hosted by webfaction. In general, things are running as expected, but I am also trying to use the ShopifyAPI, and get "Import error, no module named shopify" traced to one of my views.py. Everything worked when developing on localhost.
I SSHed into the host server and tried to install the ShopifyAPI with easy_install. It seemed to have reported being successfully installed, but I'm not sure if this actually does anything real on an external server?
Does anybody have suggestions? Any limitations on ShopifyAPI that I may not have considered?
Thanks!
The easy_install command will install the module for Python2.4. You are likely using Python2.6 or Python2.7. If you are using Python2.6, enter:
easy_install-2.6 ShopifyAPI instead of easy_install ShopifyAPI.
If you are using Python2.7, enter:
easy_install-2.7 ShopifyAPI insead of easy_install ShopifyAPI.
You can read more about using easy_install on Webfaction here
After installing the API, restart your Apache instance and it should see the module as expected.