Tabpy: function Deployment fails on Docker running Tabpy - python

I am trying to deploy function to tabpy server , but I am getting following error while executing :
client.deploy('add',add,'adding x and y')
I am getting following error :
Overwriting existing file "/usr/local/lib/python3.9/site-packages/tabpy/tabpy_server/staging/endpoints/name/1" when saving query object
Error with server response. code=500; text={"message": "error adding endpoint", "info": "FileNotFoundError : [Errno 2] No such file or directory: '/usr/local/lib/python3.9/site-packages/tabpy/tabpy_server/staging/endpoints/name/1'"}
I am able to deploy if I run tabpy on my local machine , but running in docker is not working.

You can only deploy functions directly from Tabpy server. remote deployment is not possible.

Related

Django on Google App Engine: how to connect to cloud database to run makemigrations?

I have been following this tutorial to create Django cloud app. I have been stuck on the 'Run the app on your local computer' part of the tutorial. Before running cloud_sql_proxy.exe command, I have created .env file and pasted its contents into Permissions on Google Cloud, so theoretically, after running set GOOGLE_CLOUD_PROJECT=PROJECT_ID, I could delete this .env file from repository as it would recognize it anyway. But for now, I left it. What is more, I activate env correctly in the project dir when I ran command in this location, gcloud sql instances describe INSTANCE_NAME it works OK and displays database info.
Then, I have opened new Cloud SDK and ran command: cloud_sql_proxy.exe -instances="PROJECT_ID:REGION:INSTANCE_NAME"=tcp:5434.
The result is:
2021/11/08 17:11:11 Listening on 127.0.0.1:5434 for PROJECT_ID:REGION:INSTANCE_NAME
2021/11/08 17:11:11 Ready for new connections
2021/11/08 17:11:11 Generated RSA key in 116.9931ms
The reason behind why it is 5434 and not 5432 and 5433 as that these ports were busy. I must say that I have also downloaded postgresql and specified these:
information.
After running in env (Google SDK) respectively:
set GOOGLE_CLOUD_PROJECT=PROJECT_ID
set USE_CLOUD_SQL_AUTH_PROXY=true
python manage.py makemigrations , this error occurs:
C:\Users\User\Desktop\cloud\python-docs-samples\appengine\standard_python3\django\env\lib\site-packages\django\core\management\commands\makemigrations.py:105: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': FATAL: database "DATABASE_NAME" does not exist
warnings.warn(
No changes detected
I believe that it is because I must somehow know which port to use locally instead of 5434, to connect to a cloud through proxy. How to find this and fix the issue?
PS. note that i replaced real names to be PROJECT_ID, REGION, INSTANCE_NAME, DATABASE_NAME

run_web.sh not found even though it's there in dir?

I just installed Docker, after setting up few things like Python, Django, etc., I got an error before my web server gets running.
To get web server running I have written a script named run_web.sh. It's also configured in docker-compose.yml that to run web server, run a command exec run_web.sh. When executing that command, it throws an error as below:
Starting portalapi_web_1 ... error
ERROR: for portalapi_web_1 Cannot start service web: oci runtime error: container_linux.go:265: starting container process caused "exec: \"./run_web.sh\": stat ./run_web.sh: no such file or directory"
ERROR: for web Cannot start service web: oci runtime error: container_linux.go:265: starting container process caused "exec: \"./run_web.sh\": stat ./run_web.sh: no such file or directory"
ERROR: Encountered errors while bringing up the project.
Where run_web.sh file is in my root dir of the project same as docker-compose.yml, it is not able to find it. Don't know what is the issue.
Even when I run exec run_web.sh from my root dir, still gets error : Not Found
If your ENTRYPOINT is the default one ( /bin/sh -c), which you can check with a docker image inspect <yourImage>, then try simply as a CMD:
/full/path/of/run_web.sh
That way, you reference directly what you want to launch.

mongodb refusing connection in python

I am using windows8, for writing code I use IDLE. I tried to connect python to mongodb. But when trying to get collection name than it gives an error.
ServerSelectionTimeoutError: localhost:20101: [Errno 10061] No connection could be made because the target machine actively refused it
This is code for which i am getting an error.
from pymongo import MongoClient
connection = MongoClient('localhost',20101)
db = connection['Bhautik']
collection = db['Student']
db.collection_names(include_system_collections=True)
By the output message you probably didn't set your mongo bind_ip or didn't set the dbpath. Try this:
mongod --dbpath <database_path> --bind_ip 127.0.0.1 --port 20101
It would be more helpful to put alongside with your code some information regarding the mongodb configuration, like the server port, if you are using authentication or not, which dbpath you are using and so on.
So put in your question your mongodb.conf (if you are using one) or the command you are using to start the mongo server.
If you are starting to use mongoDB after installation, make C:/data/db because it is a default database directory which mongoDB uses.
To change the database directory, do type below:
C:\Program Files\MongoDB\Server\3.x\bin> mongod --dbpath "c:\custom_folder"
You can try
run mongo like that:
"C:\\Program Files\\MongoDB\\Server\\3.6\\bin\\mongod.exe" --dbpath E:\\data\\db --port 27017 --bind_ip 127.0.0.1
E:\data\db should be your location path
then in you code
it will lok like
client = MongoClient("127.0.0.1", 27017)
db = client['addsome']
datas = db.follow_up
and if you want to access from a distant machine make sure you open the port "27017" in the firewall
Some times it's gives this error when you forgot to run the local server (if it's run with local server).
To run it you need to write on your terminal:
mongod
or, if MongoDB not in PATH, you can find it via this link in your computer:
C:\Program Files\MongoDB\Server\4.0\bin\mongod.exe
In order to run MongoDB,
You should have installed MongoDB into your OS, download it from https://www.mongodb.com/download-center/community?tck=docs_server
Add the installation's bin folder to your system environment variables.
Openup the terminal and check 'mongod' and 'mongo' commands are working.
Then try to rerun your python script.

django model import error on aws ec2, but runs fine on localhost, heroku and bluemix

getting the following error when accessing app on ec2 :-
ImportError at /
cannot import name <model_name>
..
..
Exception Location: /opt/ubuntu/projects/<project_name>/<app_name>/models.py in <module>, line 13
--didn't get any errors while deploying it to ec2.
--the app works fine on localhost as well as on heroku and bluemix.
Also, tried importing the model in the remote instance's python shell but got no errors :-
ssh -i ~/.ec2/<mykey>.pem ubuntu#54.169.xx.xxx
cd opt/ubuntu/projects/<project_name>
source ../../envs/<project_name>/bin/activate
python manage.py shell
from <app_name>.models import <model_name>
this unfortunately didn't give any errors.
What is causing this then?

How to deploy scrapy project

I am trying to deploy scrapy project.
But getting error :
My scrapy.cfg file is :
[settings]
default = eScraper.settings
[deploy]
url = http://localhost:8680/
project = eScraper
And i used this command to deploy : scrapy deploy default -p eScraper
But getting error
Building egg of eScraper-1369325126
'build/scripts-2.7' does not exist -- can't clean it
zip_safe flag not set; analyzing archive contents...
Deploying eScraper-1369325126 to http://localhost:8680/addversion.json
Deploy failed: <urlopen error [Errno 111] Connection refused>
I tried changing port also but it didn't worked also i tried using above command with sudo but nothing .....can some one help me.......
If you're using lastest version of scrapy (mine 0.24.2) then
scrapy server
no longer exist, it was moved to separate package called scrapyd
simply run
scrapyd
to start the service
Please first run This command scrapy server and then run deploy command on the another terminal...

Categories