python elasticsearch error in modifying and adding doc during remote access - python

Hello I have some questions..
I developed django website on Windows 10 and changed OS to ubuntu for publishing
On Windows, there were no problems but problems appeared on ubuntu
My website uses a remote access on EleasticSearch and also uses elasticsearch, elasticsearch_dsl python lib.
There was no error searching the document in index from an external connection, but an error occurs when adding update_by_query or a new document.
There are no other settings except for modifying network.host in elasticsearch.yml to 0.0.0.0
Do I need special permissions or other settings to modify or create documents from outside?
I am so stressed because of this.
If anyone knows, I'm sure you're busy, but please give me a detailed explanation or a link.
Thank you.

Related

Python Setup on NameCheap showing Error 503. Service Unavailable

I am new to NameCheap and I need help deploying a Django application. I just tried installing python on Namecheap's Cpanel using Python 3.7.12 with the desired Application URL, but I get the Error 503. Service Unavailable when I visit the Application URL after creating the python app. From the resources I have seen, I am supposed to get a python signification that the python app works and not an error. Thanks in advance.
python app setup on Namecheap's Cpanel
error page when i visit the application's Url
In my experience, Why does it appear?
The Webserver is currently unable to handle the HTTP request due to a temporary overloading or maintenance of the server.
Also among reasons can be:
inodes/disk overusage
irrelevant php.ini/htaccess directives
incorrect PHP version used
lack of memory
Solution:
Switch PHP versions;
Check disk space and inodes usage, etc.;
Check error logs and the latest error messages to find which script, plugin, etc. causes the issue;
ensure the server is up and running.

Add Topics to a registry with Python API

I need some help with the Google IoT Core API for Python...
For now I'm able to create and delete a registry as needed but, I need to also edit the registry to add more topics to it.
I researched a lot the documentation but no luck, maybe someone here have a similar issue or request? I need to be able to add Topics to a existent registry with active devices in it (no delete and re-creation possible?)
Any help is Greatly appretiated
EDIT: I found this reference: Link to API Reference
But I cant issue the command correctly :( a example could be usefull
You may use the google SDK to edit the registry and wrap the Shell command in a python script that format the topics, the proyect name, etc... the shell comand has this sctructure:
gcloud iot devices update {DEVICE_ID}
--project={PROJECT_ID}
--region={REGION}
--registry={REGISTRY_ID}
For more information of the shell comand check the documentation:
google registry docs

Send message to a kafka topic using java

After several weeks looking for some information here and google, I've decided to post it here to see if anyone with the same problem can raise me a hand.
I have a java application developed in Eclipse Ganymede using tomcat to connect with my local database. The problem is that I want to send a simple message ("Hello World") to a Kafka Topic published on a public server. I've imported the libraries and developed the Kafka function but something happens when I run in debug mode. I have no issues or visible errors when compiling, but when I run the application and push the button to raise this function it stops in KafkaProducer function because there is NoClassDefFoundError kafka.producer..... It seems like it is not finding the library properly, but I have seen that it is in the build path properly imported.
I am not sure if the problem is with Kafka and the compatibility with Eclipse or Java SDK (3.6), it could be?. Anyone knows the minimum required version of Java for Kafka?
Also, I have found that with Kafka is really used Scala but I want to know if I can use this Eclipse IDE version for not change this.
Another solution that I found is to use a Python script called from the Java application, but I have no way to call it from there since I follow several tutorials but then nothing works, but I have to continue on this because it seems an easier option. I have developed the .py script and works with the Kafka server, now I have to found the solution to exchange variables from Java and Python. If anyone knows any good tutorial for this, please, let me know.
After this resume of my days and after hitting my head with the walls, maybe someone has found this error previously and can help me to find the solution, I really appreciate it and sorry for the long history.
Please include the Kafka client library within the WAR file of the Java application which you are deploying to Tomcat
Please use org.apache.kafka.clients.producer.KafkaProducer rather than kafka.producer.Producer (which is the old client API) and make sure you have the Kafka client library on the classpath. The client library is entirely in Java. It's the old API that's written in scala, as is the server-side code. You don't need to import the server library in your code or add it to the classpath if you use the new client API.
At the end the problem was related with the library that was not well added. I had to add it in the build.xml file, importing here the library. Maybe this is useful for the people who use an old Eclipse version.
So now it finds the library but I have to update Java version, other matter. So it is solved

Installing XMPP on a Python server

I am attempting to follow set up the python xmpp server for GCM as detailed here:
https://developer.android.com/google/gcm/ccs.html
The website I used for hosting is pythonanywhere.com
My issue is that when I saw import xmpp, it says that no such module is found.
Should I be trying to install it on their server? I realize that this issue is probably really basic, but I have looked online for the last hour or so without much fruit. I see all these variations on XMPP and am not sure if I have to deal with any of those or if I can just do exactly what the google demo is saying.
Thanks for your time,
-Alper
PythonAnywhere doesn't support raw TCP socket connections or websockets, so XMPP may not work. But then again, from reading wikipedia, it does look like there's a pure-HTTP alternative, so it might work.
Check out this guide to installing new modules: https://www.pythonanywhere.com/wiki/InstallingNewModules. My suggestion would be to use a virtualenv for your web app, and install flask and xmpp into that...
You will have to download and install the missing python package. You may do this manually via SSH if the provider gives you access, or there may be a way to include a requirements document such that the server looks and downloads needed packages automatically. It all depends on the host, the access they allow you, and their automation features.

problems doing the Django tutorial on Dreamhost using Passengers

I have looked and I could not find this question before, and it surprises me.
I am reasonably proficient in Python, and I used Dreamhost for a number of years. Now I would like to learn Django. They are finally supporting it using Passenger. Which I do not know what is.
Following the instructions on Dreamhost I installed Django. Then I started following the tutorial 01. This went well, except that I could not start the server (this in the tutorial) since the code was live on dreamhost. At the time this did not seem to make any difference. Then when I went on the second part of the tutorial I had to access the admin site. And it worked well going to myurl/admin/ , as it should. But here the problems started. According to the tutorial (here) I have to add a file in the poll application and then restart the server. But I never started the server in the first place, my code is running live on the web... but when I add a file the website the admin acts as if it does not see it.
Probably dreamhost has started its own server, and I don't know how to restart it. But I assume this is going to be a common problem when you run django on dreamhost. Every time you add a file you will have to tell the server to consider it.
So what should I do to let the server know about it?
Thanks,
Pietro
Here's the relevant section of the Passenger user's guide for restarting Passenger:
http://www.modrails.com/documentation/Users%20guide.html#_redeploying_restarting_the_ruby_on_rails_application
Eventually I got the answer from the DH support service. They told me to
pkill python
I did it. I also checked with
ps -aux
what process I was running. And indeed I could see the python process starting when I went to the page, and being killed when I pkilled it.
Thanks for all that helped.
I had the same problem with Passenger not reloading the Django server.
According to Django wiki page on Dreamhost, you can touch a "restart.txt" file that Passenger watches. If the timestamp on the file changes, Passenger restarts Django.
If you modified your application and your changes do not seem to be reflected, you may need to notify Passenger about your change by creating or modifying ~/example.com/tmp/restart.txt:
touch /home/user/example.com/tmp/restart.txt
Source: http://wiki.dreamhost.com/Django#Hints
For the tutorial, you should be working on a local machine, not a web server.

Categories

Resources