Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

4

How to set database filter on sub domain for odoo website using apache web server

By
Anil R. Kesariya
on 10/9/14, 7:10 AM 8,334 views

Hello Everyone,

Is it possible to filter database on single instance by defining server alias in apache configuration file?

I can achieve this by creating multiple sites configuration files and running multiple instance of opnerp server.

But I want that to be done by runnning single openerp instance. If anyone has idea regarding this will be appreciated.

Thank you.

Anil.

 

 

 

 

Hi Anil, I assume that you have created the databases x2 already right? -- http://opensourceholic.com/2014/05/09/deploy-openerp-using-mod_proxy-and-mod_wsgi-on-linux-server/ The page above looks sound.. But haven't tested !!but i see??. v7: group.add_option("--db-filter", dest="dbfilter", default='.*', v8 / v9alpha: group.add_option("--db-filter", dest="dbfilter", my_default='.*', So Check versions, and wsgi config and other configs. and clearly the dB's need to be created first... Good Luck

Vee
on 10/13/14, 12:39 AM

@vee I already have more than two database. I don't want to config the openerp with wsgi. I have applied the filter pattern inside the config.py file. thanks for your comment.

Anil R. Kesariya
on 10/13/14, 12:43 AM
6

swapnil wagh

--swapnil wagh--
1559
| 6 5 8
Pune, India
--swapnil wagh--

My name is Swapnil A. Wagh. I studied Master Of computer Science and work as a Software Engineer. I’m a technology enthusiast and always eager to learn new and exciting technologies. I’m constantly looking for innovative solutions to age-old problems that push the limits of what we conceive to be possible.

swapnil wagh
On 10/11/14, 4:52 AM

Hi Anil,
 

If you are working on local machine you should edit /etc/hosts with something like this:

127.0.0.1 foo.localhost

127.0.0.1 bar.localhost

where foo and bar are the db names.

Your virtual host file should look like this:

<VirtualHost *:80>

ServerName localhost

ServerAlias *.localhost // Use this if you want dbfillter on subdomain

ErrorLog /var/log/openerp/openerp-error.log

CustomLog /var/log/openerp/openerp-access.log combined

<Proxy *>

Order deny,allow

Allow from all

</Proxy>

ProxyRequests Off

ProxyPass / http://localhost:8069/

ProxyPassReverse / http://localhost:8069/

ProxyVia On

LogLevel warn

</VirtualHost>

After that  write dbfilter = ^%d$ in your openerp/tools/config.py file. After that restart apache2 and openerp.

In case you are doing all this on VPS and you bough a domain from domian provider, then you dont need to edit/etc/hosts file.

You can read a blog post for more information : http://goo.gl/1Ub8sc

Hello Swapnil Thank I appreciate response. I have followed your step but couldn't achieved my requirements. Its redirect me to create new database page in any domain.

Anil R. Kesariya
on 10/12/14, 5:32 AM

@vee I already have more than two database. I don't want to config the openerp with wsgi. I have applied the filter pattern inside the config.py file. thanks for your comment.

Anil R. Kesariya
on 10/13/14, 12:42 AM

@Anil Can you give me some more details for better understanding your issue, Are you working on local machine? Can you share your Apache configuration and openerp configuration?

swapnil wagh
on 10/13/14, 2:14 AM

@Swapnil Yes I am working on local machine. I have gone through all the step you mention. I can login through applied domain on virtual host. only remaining portion is to set sub domain for database.

Anil R. Kesariya
on 10/13/14, 2:18 AM

@Anil, did you create two entries like 127.0.0.1 foo.localhost 127.0.0.1 bar.localhost replace foo and bar with your two database names, on local you can't use serverAlise for subdomain, use foo.localhost.com as servername then change db-filter in openerp/tools/config.py to %d. It should work I personally when I deploy openerp.

swapnil wagh
on 10/14/14, 5:17 AM

@sapanil. Previously i used server alias for sub domain. I replaced with the specific subdomain. still having same screen of manage database.

Anil R. Kesariya
on 10/15/14, 1:33 AM
@Anil,

Do you really have a database on server please check the db user might be you have db but the owner is different than what you have in openerp config, odoo redirect you to database manager page only when you don't have db single db created on server.

On Wed, Oct 15, 2014 at 11:03 AM, Anil Kesariya <a.kesariya.serpentcs@mail.odoo.com> wrote:

@sapanil. Previously i used server alias for sub domain. I replaced with the specific subdomain. still having same screen of manage database.

--
Anil Kesariya
Sent by Odoo Inc. using Odoo about Forum Post False

swapnil wagh
on 10/15/14, 9:36 AM

@swapnil I am not using service file to start openerp server. my openerp server is running manually.

Anil R. Kesariya
on 10/15/14, 9:50 AM

@swapnil I have gone through the main db filter method which is defined in openerp/http.py . In that method it using the httprequest.environ.get('HTTPHOST', '').split(':')[0] which should return the domain passed on browser. instead domain i am getting the ip address 127.0.0.1 and this value is manipulated get database. instead i modified the method and applied HTTP_X_FORWARDED_HOST instead HTTP_HOST h = httprequest.environ.get('HTTP_X_FORWARDED_HOST', '').split(':')[0] than it returns me the exact domain name eg. subdomain.localhost.com so it filter the correct data and return the filtered database list and works well. is it correct method to modified the code of odoo? or am I forgot anything to configure?

Anil R. Kesariya
on 10/16/14, 2:04 AM

@Anil What you did is also ok, but when we use %d for db-filter in configuration it works, but as its filter the database it matches the subdoamin means if you have db like anil1 , anil2 and odoo and you use anil.domain.com it will show both db starts with anil except odoo in dropdown. So what you did is correct to get out from this issue. If you need any help from me I can help you to solve your subdomain issue.

swapnil wagh
on 10/16/14, 8:25 AM

Thanks sure.

Anil R. Kesariya
on 10/17/14, 12:54 AM
0
Shivam Mahajan
On 12/18/15, 1:11 AM

Can you please    tell me how to configure multi domains foe multi companies in odoo9.........the help would be appreciated

0
Natys
On 5/28/15, 10:56 AM

Hi all,

May be this help you.

We find a solution for use %h and subdomain, create your db in replace '.' by '-'.

Example : for the domaine erp.pharmacy.com, create db erp-pharmacy-com

And in your file .conf, at line dbfilter, write this : dbfilter = %h

Works for Odoo v8

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 10/9/14, 7:10 AM
Seen: 8334 times
Last updated: 12/18/15, 1:11 AM