Django GeoIP

2010-07-16 Thread haibin
hi,

I am trying to use GeoIP part of GeoDjango. I importing it by from
django.contrib.gis.utils import GeoIP but getting import error. Do I
have to install someting or do the whole installation process for
GeoDjango? Or what is the minimum requirements just for GeoIP

Thanks,
James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django GeoIP

2010-07-17 Thread Alexander Jeliuc
Yes. there are dependencies.

On Sat, Jul 17, 2010 at 8:58 AM, haibin  wrote:

> hi,
>
> I am trying to use GeoIP part of GeoDjango. I importing it by from
> django.contrib.gis.utils import GeoIP but getting import error. Do I
> have to install someting or do the whole installation process for
> GeoDjango? Or what is the minimum requirements just for GeoIP
>
> Thanks,
> James
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django GeoIP

2010-07-17 Thread Justin Myers
Yes, there are dependencies for GeoIP. They're listed in the docs for
GeoIP (http://docs.djangoproject.com/en/1.2/ref/contrib/gis/geoip/),
and the docs' list of GeoDjango's requirements in general (http://
docs.djangoproject.com/en/1.2/ref/contrib/gis/install/#requirements)
is also useful.

HTH,
Justin

On Jul 17, 12:58 am, haibin  wrote:
> hi,
>
> I am trying to use GeoIP part of GeoDjango. I importing it by from
> django.contrib.gis.utils import GeoIP but getting import error. Do I
> have to install someting or do the whole installation process for
> GeoDjango? Or what is the minimum requirements just for GeoIP
>
> Thanks,
> James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django GeoIP

2010-07-17 Thread haibin
Thanks All,

Its now clear to me. For sharing purpose, maybe I'll go for pygeoip?
Since I really only need the GeoIP only. Much simpler, though could be
much slower?



On Jul 18, 12:20 am, Justin Myers  wrote:
> Yes, there are dependencies for GeoIP. They're listed in the docs for
> GeoIP (http://docs.djangoproject.com/en/1.2/ref/contrib/gis/geoip/),
> and the docs' list of GeoDjango's requirements in general (http://
> docs.djangoproject.com/en/1.2/ref/contrib/gis/install/#requirements)
> is also useful.
>
> HTH,
> Justin
>
> On Jul 17, 12:58 am, haibin  wrote:
>
>
>
> > hi,
>
> > I am trying to use GeoIP part of GeoDjango. I importing it by from
> > django.contrib.gis.utils import GeoIP but getting import error. Do I
> > have to install someting or do the whole installation process for
> > GeoDjango? Or what is the minimum requirements just for GeoIP
>
> > Thanks,
> > James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django GeoIP

2010-07-18 Thread Justin Myers
I did a little bit of experimenting with pygeoip a few months ago, and
it didn't seem to be _much_ slower. I wasn't doing a huge number of
requests or anything, though. Depending on your application, it's
definitely worth looking into.

On Jul 17, 6:49 pm, haibin  wrote:
> Thanks All,
>
> Its now clear to me. For sharing purpose, maybe I'll go for pygeoip?
> Since I really only need the GeoIP only. Much simpler, though could be
> much slower?
>
> On Jul 18, 12:20 am, Justin Myers  wrote:
>
> > Yes, there are dependencies for GeoIP. They're listed in the docs for
> > GeoIP (http://docs.djangoproject.com/en/1.2/ref/contrib/gis/geoip/),
> > and the docs' list of GeoDjango's requirements in general (http://
> > docs.djangoproject.com/en/1.2/ref/contrib/gis/install/#requirements)
> > is also useful.
>
> > HTH,
> > Justin
>
> > On Jul 17, 12:58 am, haibin  wrote:
>
> > > hi,
>
> > > I am trying to use GeoIP part of GeoDjango. I importing it by from
> > > django.contrib.gis.utils import GeoIP but getting import error. Do I
> > > have to install someting or do the whole installation process for
> > > GeoDjango? Or what is the minimum requirements just for GeoIP
>
> > > Thanks,
> > > James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django GeoIP Module not found; can't remedy

2012-05-24 Thread DF


I've spent several hours attempting to resolve my problems setting up GeoIP 
in Django to no avail and was hoping to get some guidance on what the 
problem(s) might be.

I'm working on an existing Django application that required some 
geolocation abilities, specifically getting a users IP and lat/long and 
then placing that info on a map marker. GeoIP and the associated libraries 
appeared to be the best solution for the first step.

I installed GeoIP on a Mac using Homebrew. I then manually created a folder 
in the root directory of my project with the GeoIPv6.data and 
GeoLiteCity.dat files. After this, I added the path in my settings file:

import os

DEBUG = True

TEMPLATE_DEBUG = DEBUG

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

GEOIP_PATH = os.path.join(BASE_DIR, 'geoip'),

I then opened a command shell for the project and received the following 
error:

>>> from django.contrib.gis.geoip import GeoIP

Traceback (most recent call last):

  File "", line 1, in 

ImportError: No module named geoip

I can't seem to remedy this problem. One issue that may be the cause is 
extracting the two dat.gz files was an issue. Neither could be unzipped 
from the command line – neither are .zip files – and had to use Stuffit 
Expander to open these. The resulting dat files in my project IDE (pyCharm) 
have a VLC (?) icon on each. Perhaps this is part of the issue (finding a 
way to uncompress the file was a challenge in itself). I'm not sure as the 
module was not even found.

Any help would be extremely appreciated in resolving this issue as I can't 
progress any further without figuring out what's wrong.

Many thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/krtmdm5BjQ4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django GeoIP Module not found; can't remedy

2012-05-24 Thread DF
It appeared an import statement error caused the initial problem. But once 
that was fixed, the following error results:

">>> from django.contrib.gis.utils.geoip import GeoIP
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/gis/utils/geoip.py",
 
line 68, in 
lgeoip = CDLL(lib_path)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py",
 
line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/usr/local/lib/libGeoIP.dylib, 6): no suitable image found. 
 Did find:
/usr/local/lib/libGeoIP.dylib: mach-o, but wrong architecture"

Anyone have a clue on how to remedy this?

On Thursday, May 24, 2012 7:10:50 PM UTC-4, DF wrote:
>
> I've spent several hours attempting to resolve my problems setting up 
> GeoIP in Django to no avail and was hoping to get some guidance on what the 
> problem(s) might be.
>
> I'm working on an existing Django application that required some 
> geolocation abilities, specifically getting a users IP and lat/long and 
> then placing that info on a map marker. GeoIP and the associated libraries 
> appeared to be the best solution for the first step.
>
> I installed GeoIP on a Mac using Homebrew. I then manually created a 
> folder in the root directory of my project with the GeoIPv6.data and 
> GeoLiteCity.dat files. After this, I added the path in my settings file:
>
> import os
>
> DEBUG = True
>
> TEMPLATE_DEBUG = DEBUG
>
> BASE_DIR = os.path.dirname(os.path.abspath(__file__))
>
> GEOIP_PATH = os.path.join(BASE_DIR, 'geoip'),
>
> I then opened a command shell for the project and received the following 
> error:
>
> >>> from django.contrib.gis.geoip import GeoIP
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
>
> ImportError: No module named geoip
>
> I can't seem to remedy this problem. One issue that may be the cause is 
> extracting the two dat.gz files was an issue. Neither could be unzipped 
> from the command line – neither are .zip files – and had to use Stuffit 
> Expander to open these. The resulting dat files in my project IDE (pyCharm) 
> have a VLC (?) icon on each. Perhaps this is part of the issue (finding a 
> way to uncompress the file was a challenge in itself). I'm not sure as the 
> module was not even found.
>
> Any help would be extremely appreciated in resolving this issue as I can't 
> progress any further without figuring out what's wrong.
>
> Many thanks.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/HYN3pfOXCNIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django GeoIP Module not found; can't remedy

2012-05-28 Thread Thomas Lockhart

...
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", 
line 353, in __init__

self._handle = _dlopen(self._name, mode)
OSError: dlopen(/usr/local/lib/libGeoIP.dylib, 6): no suitable image 
found.  Did find:

/usr/local/lib/libGeoIP.dylib: mach-o, but wrong architecture"

I've been using macports and virtualenv so have not run into this 
(pretty much everything gets built and installed in /usr/local, 
including a new build of python itself).


But you are using Apple's python and a homebrew build of GeoIP and 
python is clearly complaining that you do not have a compatible build of 
the library.


Use the "file" command to examine the python installation and your 
libGeoIP library (example from my system; yours has some different paths):


$ otool -L /usr/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/Python 
(compatibility version 2.7.0, current version 2.7.1)

...
$ file /System/Library/Frameworks/Python.framework/Versions/2.7/Python
/System/Library/Frameworks/Python.framework/Versions/2.7/Python: Mach-O 
universal binary with 2 architectures
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (for 
architecture x86_64):  Mach-O 64-bit dynamically linked shared 
library x86_64
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (for 
architecture i386):Mach-O dynamically linked shared library i386


I would include the geoip library in my example but it is having trouble 
building from MacPorts. Am looking into that :/


hth

   - Tom

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.