Having trouble with Tryton/GNU Health installation - python

I have installed Tryton server and client as instructed on the GNU Health website. The server is running fine. The pre-requisites required - Postgresql, Python had been installed before hand. I have created a GNU Health user but whenever I attempt creating a database in postgres, i get the error shown in the terminal below -
This is my pg_hba.conf file, with the configuration as specified in the installation instruction -
Also, this is my trytond.conf file -
Please, can someone point out what i'm doing wrong because each time i run the Tryton client, it doesn't see any server and I an only run the demo profile. Also if I try creating a database from the Tryton client, It keeps giving me an error can't create database.
I have tried several edits to the conf file with no avail.
Any help in resolving this would be appreciated.

AFAIU you have to specify a username and password to let PostgreSQL trust your connection. Also take care that you are allowing anyone to conect to your server with any login. This may be a security issue.
Using the following URI works for me:
postgresql://username:sometext#localhost:5432

Related

jupyter-notebook eith oracle connection problem

I have a problem that I've been trying to solve for a very long time and it seems like I'm missing something very basic.
I use a Linux server with Anaconda, Oracle client, Pycharm and jupyter-notebook installed.
I use python scripts in which I write and read data to Oracle DB, and I use the Cx_oracle extension.
The server has several users with a personal username for each and each of them has sudo privileges.
I performed all the installations on the server with sudo privileges.
When I try to connect from the server to Oracle DB I connect properly.
When I connect to Python on the server itself, I connect properly to Oracle DB.
When I connect using Pycharm and I define ORACLE_HOME=/OracleTools/19.0.0/ in the environment variables, I connect properly to the Oracle DB.
My problem starts when I want to use jupyter-notebook
When I try to connect to the DB I get the error -
DatabaseError: Error while trying to retrieve text for error ORA-12715
I noticed when I execute os.environ I see that it is defined for me:
ORACLE_HOME: /OracleTools/19.0.0/bin
and should be
/OracleTools/19.0.0
So I changed using command os.environ['ORACLE_HOME'] = '/OracleTools/19.0.0'
Then I get an error:
DatabaseError: ORA-12715: invalid character set specified
And of course this change is not permanently saved ...
If on the server itself I execute the env command both in the private user and in sudo I see ORACLE_HOME: /OracleTools/19.0.0 and not ORACLE_HOME: /OracleTools/19.0.0/bin
My questions:
Where does the data I get in the os.environ command come from?
How can I edit them permanently ?
Is this even the problem I'm having or should I check something else?
I manage to import cx_oracle, which means that there is no problem of expansion
Thanks!

Heroku Django app: ECONNRESET: read ECONNRESET

I'm getting the below error when trying to run the command heroku run python manage.py migrate from the terminal.
ECONNRESET: read ECONNRESET
I followed the link in the heroku docs to check if there was a firewall issue, but I had a successful telnet connection. I haven't been able to find any other examples of anyone running into this issue unless they are having a proxy/firewall issue but according to the telnet test it doesn't seem like I have a problem right?
I've also tried testing any other heroku run command I can think of and I get the same result.
After reading the logs it showed that there was an Error Code R13. I was able to follow this thread to get what I needed to be fixed but was unable to run anything that needs to actually be attached (like an interactive shell).
Tried filing something with Heroku support but they basically said that it's outside the scope of free support. Disappointing.
The problem is related with a proxy in your internet connection.
Try to connect to heroku by using another internet connection, for example your mobile phone tethering.
It worked for me.
The problem is as a result of your internet connection provider blocking Heroku server. Change the source or provider of your internet and you will be able to connect to the Heroku Django console.

Using python flask and pexpect works on flask development server fails with WSGI

I am writing a tool for internal use at work. A user enters a router or switch IP address, username and password into a web form. The app then uses pexpect to SSH into the device, downloads a configuration and tests that the configuration complies with various standards by running true/false tests (e.g. hostname is set). Leaving aside whether this is a good idea or not, my problem is that when I run the program under the Flask development program it works fine. When I set it up to run under WSGI it fails at the SSH portion with the error:
pexpect.exceptions.ExceptionPexpect: The command was not found or was not executable: ssh.
I tried uWSGI and Unicorn and played with the number of workers etc. to no avail.
I suspect this is a setuid root thing. Google searches do not point to a solution. Can anyone lead me to a fix? If pexpect will not work, I may give up and require the user to upload a config file they save themselves but I am frustrated that this works on the flask development server but not a production server.
You probably just need to replace ssh with its full path, e.g. /usr/bin/ssh.
You can find the full path with which ssh.

updating to newest ubuntu has made it so I can't access mysql...what do I do?

I updated to the latest ubuntu distribution and now I can't access my mysql databases! I used to log in with root without a password, and now when I try to log in I don't have access because I don't know the password.
There are a lot of questions that are similar to this online. I followed a few of them and the furthest I get is this error:
(2002, "Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)")
I tried to follow /var/run/mysqld/mysqld.sock and I don't have a mysqld folder.
So I imagine that's a problem. Other questions I've seen on here point to /etc/mysql/...mysql.cnf.
I have that file but the file doesn't contain anything about a socket.
I'm totally at a loss for how I get access to my databases that I've built! Please help! What should I do?
From terminal:
sudo service mysqld start
Error show that the mysql server is not running on your ubuntu machine.

Flask app fails to render when deploying code to Azure Web with a database connection, but works fine from local server

I have an Azure web app with a Flask template. I want it to connect to a SQL database. I made one. I installed pymssql. For testing purposes I added to the views.py in the root folder:
import pymssql
conn = pymssql.connect(server='mydb.database.windows.net', user='mydbnameadmin#mydb', password='secret', database='mydb')
I first tested locally on my kubuntu box. To make sure I was getting a connection, I entered the wrong password, and the server threw an error. I entered it correctly and the error disappeared. Cool. Also the SQL dashboard on the azure portal reported sucessfull connections. So then I pushed my changes (including updating the requirements.txt) to my github repo and it was sucked into my web application. When I tried running the web app, on the index page:
The page cannot be displayed because an internal server error has
occurred.
After turning on and inspecting the detailed logs all I get it:
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
IIS. What's that doing here? I thought MS was trendy and hosted this service on a linux box 0_0
I remove the second line
conn = pymssql.connect(server='mydb.database.windows.net', user='mydbnameadmin#mydb', password='secret', database='mydb')
and the error disappeared. If I run a server locally, which still uses the Azure SQL server, I don't have any issues.
This seems to be the same issue I have:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/e20bb2a3-bdbe-4e49-8b92-b36fe50577da/having-trouble-deploying-flask-app-into-azure-with-azure-database?forum=windowsazurewebsitespreview&prof=required
but they say whether they actually got it working with a SQL database...
what do people think?
Thanks
my requirements.txt
alembic==0.7.7
azure==0.11.1
Flask==0.10.1
Flask-Migrate==1.5.0
Flask-Script==2.0.5
Flask-SQLAlchemy==2.0
futures==3.0.3
itsdangerous==0.24
Jinja2==2.8
Mako==1.0.1
MarkupSafe==0.23
pymssql==2.1.1
python-dateutil==2.4.2
six==1.9.0
SQLAlchemy==1.0.8
Werkzeug==0.10.4
wheel==0.24.0
Per my understanding, Azure Web sites are hosted on Windows Server 2012 VM by default, which would not install FreeTDS and also we don't have permission to install it. And the pymssql is based on FreeTDS.
So we can use pyodbc to connect the Azure SQL as a workaround way to handle it in ease.
I was able to successfully connect my Python code to a SQL Database on Azure using the pymssql 2.1 library.
I don't know if this is what is causing the problem but I did include a couple of extra parameters in my connection string... maybe that will help. I specified the driver explicitly and the Encrypt parameter since SSL is always enabled for SQL Azure (I believe)
myConnection = pyodbc.connect('Driver={SQL Server};'
'Server=tcp:1234567.database.windows.net,1433;'
'Database=MyAzureDatabase;'
'Uid=geekgirl#123456;Pwd=abcdef;'
'Encrypt=yes')
If that doesn't work, maybe try adding some error handling around the connect statement to try and get a more specific error message.
Fingers crossed!
I had this problem, but I eventually realized it was because I was using the 64-bit version of Python in Visual Studio, but Azure only supports the 32-bit version.
I was seeing:
DLL load failed: %1 is not a valid Win32 application.
Once I switched to installing and using the 32-bit version I was able to use Flask and pyodbc with no problems.

Categories

Resources