issues with OpenERP installation - python

I am installing openerp at my local server, I have installed it and its dependences but after finishing its installation when i run server 'openerp-server' and acces it using 0.0.0.0:8069/. I got the following error
OpenERP Server Error
Client Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/addons/web/http.py", line 195, in dispatch
response["result"] = method(self, **self.params)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/addons/web/controllers/main.py", line 709, in get_list
return db_list(req)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/addons/web/controllers/main.py", line 88, in db_list
dbs = proxy.list()
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/addons/web/session.py", line 31, in proxy_method
result = self.session.send(self.service_name, method, *args)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/addons/web/session.py", line 104, in send
raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
Server Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/addons/web/session.py", line 90, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/netsvc.py", line 295, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/service/web_services.py", line 122, in dispatch
return fn(*params)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/service/web_services.py", line 351, in exp_list
cr = db.cursor()
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/sql_db.py", line 477, in cursor
return Cursor(self._pool, self.dbname, serialized=serialized)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/sql_db.py", line 183, in __init__
self._cnx = pool.borrow(dsn(dbname))
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/sql_db.py", line 378, in _locked
return fun(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130211_002141-py2.7.egg/openerp/sql_db.py", line 433, in borrow
result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, in connect
connection_factory=connection_factory, async=async)
OperationalError: FATAL: role "ghrix" does not exist
I haven't recognize this error.
One more thing , I haven't edit OpenERP server configuration file . And if I have to edit this file then what are those changes.
Thanks.

This error indicates that OpenERP is trying to connect to the PostgreSQL database server using the "ghrix" user, which does not exist. This is probably the user under which you are starting the server.
If you have created a special database user for OpenERP you need to specify it on the command-line using --db_user=DB_USER (and in that case you probably also need --db_host=localhost and --db-password=YOUR_PASSWORD).
If you haven't created any database user yet, the easiest solution is probably to create one named ghrix, e.g.:
$ sudo su - postgres
$ createuser -s ghrix # -s to make a super-user that can create DBs
Note: Use ./openerp-server --help to see all possible startup parameters for the OpenERP server. You can also put the command-line options in a config file: just execute
$ ./openerp-server -s
and then edit the sample config file that is created in $HOME/.openerp_serverrc

Even though the question has been answered, the following is a concise tutorial on installing a production grade OpenERP Server, that also explains how to set up the database, manage access rights and configure your OpenERP installation:
http://www.theopensourcerer.com/2012/02/how-to-install-openerp-6-1-on-ubuntu-10-04-lts/

you should check two case
First case:
$ sudo su - postgres $ createuser -s ghrix
second case
fill the db user and db password in
/odoo/debian/odoo.conf
run odoo with this parameter
./odoo-bin -c /opt/odoo/debian/odoo.conf
If not resolved comment below i try to resolve it

Related

How do I install GNUHealth?

I am following the installation steps mentioned below but have encountered a python problem.
https://en.wikibooks.org/wiki/GNU_Health/Installation#Installing_GNU_Health_on_GNU/Linux_and_FreeBSD
At the step where the initialisation of the database instance is to be performed, I have encountered the following error after executing the following command.
python3 ./trytond-admin --all --database=health
Error encountered:
Traceback (most recent call last):
File "./trytond-admin", line 21, in <module>
admin.run(options)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-4.6.18/trytond/admin.py", line 24, in run
with Transaction().start(db_name, 0, _nocache=True):
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-4.6.18/trytond/transaction.py", line 88, in start
database = Database(database_name).connect()
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-4.6.18/trytond/backend/postgresql/database.py", line 97, in __new__
**cls._connection_params(name))
File "/home/gnuhealth/.local/lib/python3.6/site-packages/psycopg2/pool.py", line 161, in __init__
self, minconn, maxconn, *args, **kwargs)
File "/home/gnuhealth/.local/lib/python3.6/site-packages/psycopg2/pool.py", line 58, in __init__
self._connect()
File "/home/gnuhealth/.local/lib/python3.6/site-packages/psycopg2/pool.py", line 62, in _connect
conn = psycopg2.connect(*self._args, **self._kwargs)
File "/home/gnuhealth/.local/lib/python3.6/site-packages/psycopg2/__init__.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: fe_sendauth: no password supplied
Can anyone help me out with this error or tell me what I am missing?
Based on the error, I suspect that there's a difficulty in connecting to the DB as there is no password specified.
It seems that you did not configured the URI with the credentials to connect to the database. You can find the description of the configuration file at http://docs.tryton.org/projects/server/en/latest/topics/configuration.html#uri
Once you have a configuration file, you must run the command like this:
python3 ./trytond-admin --all --database=health -c /path/to/trytond.conf

No schema has been selected to create in ... error

I am working on a Linux server that is hosted on Amazon's server and I have completely set up the server. The final thing I am trying to do is host one of my old projects that I created on the server which is in the Flask framework.
I am trying to run the Python file that sets up my database that is required to run my project.
I am using a virtual machine inside the server that will run my project and every time I run the command I get the following error:
(venv) grader#ip-10-20-6-95:/var/www/catalog/catalog$ python setup_database.py
Traceback (most recent call last):
File "setup_database.py", line 63, in <module>
Base.metadata.create_all(engine)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/schema.py", line 2848, in create_all
tables=tables)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1479, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1122, in _run_visitor
**kwargs).traverse_single(element)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 122, in traverse_single
return meth(obj, **kw)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/ddl.py", line 70, in visit_metadata
self.traverse_single(table, create_ok=True)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 122, in traverse_single
return meth(obj, **kw)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/ddl.py", line 89, in visit_table
self.connection.execute(schema.CreateTable(table))
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 662, in execute
params)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 720, in _execute_ddl
compiled
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 874, in _execute_context
context)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
exc_info
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 196, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 867, in _execute_context
context)
File "/var/www/catalog/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 324, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (ProgrammingError) no schema has been selected to create in
'\nCREATE TABLE users (\n\tid SERIAL NOT NULL, \n\tusername VARCHAR(100), \n\temail VARCHAR(225) NOT NULL, \n\tprofile_pic VARCHAR(225) NOT NULL, \n\tPRIMARY KEY (id)\n)\n\n' {}
I am not sure why I get this error.
The commands I ran to set up PostgreSQL (if that should matter):
$ sudo apt-get install libpq-dev python-dev
$ sudo apt-get install postgresql postgresql-contrib
$ sudo su - postgres
$ psql
# CREATE USER catalog WITH PASSWORD 'sillypassword';
# ALTER USER catalog CREATEDB;
# CREATE DATABASE catalog WITH OWNER catalog;
# \c catalog
# REVOKE ALL ON SCHEMA public FROM public;
# GRANT ALL ON SCHEMA public TO catalog;
# \q
$ exit
How could I fix this problem?
no schema has been selected to create in
You get this error when your search_path setting has no valid first entry (typically empty). Postgres does not know in which schema to create the table.
Fix your search_path setting, or schema-qualify object names (like: public.users). But fix your search_path in any case.
Details:
How does the search_path influence identifier resolution and the "current schema"
This issue was answered already: https://dba.stackexchange.com/a/275116/114247
The fix is:
grant usage on schema public to public;
grant create on schema public to public;
I found the file created by pg_dump (under postgres 10.7) had
SELECT pg_catalog.set_config('search_path', '', false);
near the top of it. So when importing the file, it manipulated the search path, which persisted throughout the current session.
Commenting that line out (and starting a new session) fixed the problem.
You do not have a schema created. Create a schema using CREATE SCHEMA public;
then you can execute grant usage on schema public to public; and grant create on schema public to public
I was stuck across same problem and after doing a lot of research, I got the below solution, assuming you are using flask models to create database using sqlalchemy:
while creating models use the below command before defining columns of models:
__table_args__ = {"schema":"schema_name"}
Hope this helps you out.

Django: How to access test database?

I am working in Django 1.8. I have a Django management command to create materialized views on my database, as follows:
python manage.py create_db_matviews $DB_NAME $DB_USER $DB_PASS
Now I want to run the management command from inside my tests, so that I can test the command. (My actual database is extremely large, and the management command is extremely slow, so I would like to test it on test data, rather than real data.)
However calling the management command from inside my test file does not work - unsurprisingly since I have no idea what credentials to use:
def setUpModule():
management.call_command('loaddata', 'frontend/fixtures/mydata.json',
verbosity=0)
# load fixtures, then...
management.call_command('create_db_matviews',
'default', 'default', 'randomguess',
verbosity=0)
It fails as follows:
Creating test database for alias 'default' ('test_prescribing')...
... running migrations...
======================================================================
ERROR: setUpModule (frontend.tests.test_api_views)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/.../tests/test_api_views.py", line 23, in setUpModule
verbosity=0)
File "/Users/.../.virtualenvs/openprescribing/lib/python2.7/site-packages/django/core/management/__init__.py", line 115, in call_command
return klass.execute(*args, **defaults)
File "/Users/.../.virtualenvs/openprescribing/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Users/.../frontend/management/commands/create_indexes_and_matviews.py", line 19, in handle
password=db_pass)
File "/Users/.../.virtualenvs/openprescribing/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
OperationalError: FATAL: role "default" does not exist
What credentials should I use to get access to the test database?
This section of the Django docs has the details.
Basically the name of the test database is as per your settings file but with test_ prefixed, and the user and password are as your settings file.

Python mysql connector access denied error

I've read everything possible and I just can't connect to my mysql server. Here is my code. very simple. (I used xxx to hide all the private info. everything else is the way i got it.
import mysql.connector
conn = mysql.connector.connect(user='xxxx',password='xxxxx',host='xxxx',db='xxx',port=3306)
The login info is definitely correct. I tried it in a mysql client and it connected just fine. The MySQL server is hosted on dreamhost. I set the allowable IPs for the db user to wildcard %.%.%.% so anyone could connect.I don't know what else could possibly be wrong. When I try to connect in python i get:
C:\Python33\python.exe D:/Dropbox/python/v2/test.py
Traceback (most recent call last):
File "D:/Dropbox/python/v2/test.py", line 3, in <module>
conn = mysql.connector.connect(user='xxx',password='xxx',host='xxx',db='xxx',port=3306)
File "C:\Python33\lib\site-packages\mysql\connector\__init__.py", line 101, in connect
return MySQLConnection(*args, **kwargs)
File "C:\Python33\lib\site-packages\mysql\connector\connection.py", line 117, in __init__
self.connect(**kwargs)
File "C:\Python33\lib\site-packages\mysql\connector\connection.py", line 383, in connect
self._open_connection()
File "C:\Python33\lib\site-packages\mysql\connector\connection.py", line 350, in _open_connection
self._ssl)
File "C:\Python33\lib\site-packages\mysql\connector\connection.py", line 176, in _do_auth
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1044 (42000): Access denied for user 'xxx'#'%.%.%.%' to database 'xxx'
Any help would be greatly appreciated.
You will have to GRANT permissions to the user.
Something like:
GRANT ALL PRIVILEGES ON *.* TO 'user2'#'localhost' IDENTIFIED BY PASSWORD 'xxxxx'

MySQL 1045 exception

I use Django 1.3.1 & Python 2.7.2 and I'm trying to deploy a project locally with nginx.
Something wrong with manage.py after executing the first command. For example: the first command is:
$ python manage.py runfcgi host=127.0.0.1 port=7782
and it works correctly. But when I try to execute any command after that, like syncdb or anything else (runserver, validate, runfcgi, etc...), I get strange exceptions:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 102, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 338, in get_server_version
self.cursor()
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
File "/usr/lib/pymodules/python2.7/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'#'localhost' (using password: NO)")
I don't know what the reason is. In settings.py all MySQL access parameters (user, pass, dbname & host) are written correctly (syncdb succeed).
Note: if I copy the project directory for example to "project2" and rename it to original "project", the problem disappears for the first manage.py command I exectue, after that, I see the exceptions again.
I have another django projects deployed in the same way, using same django & python, but they work without any problem.
Anybody knows what the problem is?
Is your other Django project is set up on the same server/computer?
If it is, check your commas when you giving your db credentials and compare with the one which is running.

Categories

Resources