지리적 IP¶
참고
이 문서는 온프레미스 데이터베이스에만 적용됩니다.
설치¶
경고
Please note that the installation depends on your computer’s operating system and distribution. We will assume that a Linux operating system is being used.
- Install geoip2 Python library
pip install geoip2
Download the GeoLite2 City database. You should end up with a file called
GeoLite2-City.mmdb
- Move the file to the folder
/usr/share/GeoIP/
mv ~/Downloads/GeoLite2-City.mmdb /usr/share/GeoIP/
- Move the file to the folder
서버 다시 시작
참고
If you can’t/don’t want to locate the geoip database in /usr/share/GeoIP/
, you can use the
--geoip-db
option of the Odoo command line interface. This option takes the absolute path to
the GeoIP database file and uses it as the GeoIP database. For example:
./odoo-bin --geoip-db= ~/Downloads/GeoLite2-City.mmdb
더 보기
경고
GeoIP
Python library can also be used. However this version is discontinued since January
1. See GeoLite Legacy databases are now discontinued
How to test GeoIP geolocation in your Odoo website¶
웹사이트로 이동합니다. ``GeoIP``를 테스트할 웹페이지를 엽니다.
:menuselection:`사용자 지정 –> HTML/CSS/JS 편집기`를 선택합니다.
페이지에 다음 XML을 추가합니다:
<h1 class="text-center" t-esc="request.session.get('geoip')"/>
You should end up with a dictionary indicating the location of the IP address.
참고
If the curly braces are empty {}
, it can be for any of the following reasons :
The browsing IP address is the localhost (
127.0.0.1
) or a local area network one (192.168.*.*
)If a reversed proxy is used, make sure to configure it correctly. See
proxy mode
geoip2
is not installed or the GeoIP database file wasn’t foundThe GeoIP database was unable to resolve the given IP address