I have my neo4j python application using py2neo.
It is working corretly on local but when i deploy it to heroku it is giving error
py2neo.rest.SocketError
SocketError: gaierror(-2, 'Name or service not known')
I am not sure what is the issue.
what should be the correct issue I am using url for db service as
graph_db = neo4j.GraphDatabaseService("http://xyz.hosted.neo4j.org:7480/db/data/")
Configure the authentication as indicated here:
http://packages.python.org/py2neo/neo4j.html#authentication
Use heroku config to note the username and password in the URL.
For example (obviously modified):
$ heroku config
=== secure-caverns-9214 Config Vars
NEO4J_URL: http://username:password#17d0afad4.hosted.neo4j.org:7755
PATH: bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin
Related
i would like to connect to a user in my gitlab server.
i connect to the gitlab server:
import gitlab
gl = gitlab.Gitlab('http://10.0.0.120')
print(gl.users.list())
the connect to the server not getting me any errors but after adding the line:
print(gl.users.list())
i get this error:
raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabListError: 403: 403 Forbidden - Not authorized to access /api/v4/users
how can i fix this?
thanks.
Usually, we use the terminal to connect to gitlab users. You can follow the following steps:
Call the terminal with "ctrl+~" in vscode
Use command git init
Configure user name and mailbox:
git config --global user.name “user.name"
git config --global user.email "user.email"
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
I need solution to the 403 error I'm getting after successfully deploying flask app on AWS elasticbeanstalk. After deploying a flask application developed in visual studio it gives 403 forbidden error. I've tried different searches to solve the problem but they haven't resolved it.
For example, it was suggested somewhere the start-off python file should be named - application.py, which I did and redeployed but it still didn't work. It was also mentioned in another example that the deployed solution was pointing to a folder instead of the start-off file, which is not the case in my situation.
Possible problems pointed at include the inability of subdomains to work with flask host or the need to make adjustment to the code below in my runserver.py for production environment of AWS.
if __name__ == '__main__':
HOST = environ.get('SERVER_HOST', 'localhost')
try:
PORT = int(environ.get('SERVER_PORT', '5555'))
except ValueError:
PORT = 5555
app.run(HOST, PORT)
So I open the psql terminal (on Windows). I log into it with the server set on localhost,
But when I try to log into it with my production host:
xxxx.compute-1.amazonaws.com
I get the following error:
> psql: FATAL: password authentication failed for user "postgres"
> FATAL: no pg_hba.conf entry for host "128.6.37.14", user "postgres",
> database "campus", SSL off
I tried adding it to the pg_hba.conf, but no luck:
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 128.6.37.14/32 trust
Any idea what the issue is? Is the host correct? It's what I got when I ran heroku config
How do I fix this?
I assume you are using Heroku Postgres, the Heroku Database as a Service based on PostgreSQL, right?
If so, you can use the heroku pg:psql CLI command to connect to your Heroku Postgres database from outside of Heroku.
First, issue the following command to get your Heroku Postgres Add-on name:
heroku pg:info
Then you can do:
heroku pg:psql <Add-on>
e.g.
heroku pg:psql postgresql-parallel-XXXXX
anyone using django_auth_ldap against an active directory server
I am trying to set up auth through django_auth_ldap and am having an issue.
if i run my auth from the django interactive shell the auth works fine.
example from the shell
>>> from django.contrib.auth import authenticate
>>> authenticate(username='#############',password='*************')
search_s('ou=People, o=hp.com', 2, '(uid=%(user)s)') returned 1 objects: uid=###########,ou=people,o=hp.com
Populating Django ###########
Django user ########## does not have a profile to populate
<User:########## >
but the same code from within a view in the app fails with
Caught LDAPError while authenticating ##########: SERVER_DOWN({'desc': "Can't contact LDAP server"},)
I figured it out. I decided I would set up remote debugging so that I could step through the process and see where it was failing in that process I found that the httpd process was being prevented (by selinux) from making a network connection back to my eclipse IDE fixing this fixed the app. I think selinux was preventing the app from connecting to the ldap server. When I got my debug environment all worked out and stepped through it all worked fine !
the command to allow httpd to make a network connection
as root
setsebool -P httpd_can_network_connect 1