longclawshop/longclaw

ImportError with ipware.ip

reedjones opened this issue · 4 comments

ImportError raised when trying to load 'longclaw.checkout.templatetags.longclawcheckout_tags': can
not import name 'get_real_ip' from 'ipware.ip'

  • longclaw version: latest
  • Django version: latest
  • Python version: 3.7.7

When following setup instructions with above setup get this error.

related to this issue: un33k/django-ipware#45 (comment)

should use get_client_ip instead of get_real_ip perhaps?

i use these modules :) its work fine :)

anyascii==0.3.1
asgiref==3.5.2
backports.zoneinfo==0.2.1
beautifulsoup4==4.8.2
certifi==2022.5.18.1
charset-normalizer==2.0.12
Django==2.2.21
django-countries==7.3.2
django-extensions==3.1.5
django-filter==2.4.0
django-ipware==2.1.0
django-modelcluster==5.3
django-permissionedforms==0.1
django-taggit==1.5.1
django-treebeard==4.5.1
djangorestframework==3.9.0
draftjs-exporter==2.1.7
et-xmlfile==1.1.0
html5lib==1.1
idna==3.3
l18n==2021.3
longclaw==1.0.2
openpyxl==3.0.10
Pillow==7.2.0
pytz==2022.1
requests==2.27.1
six==1.16.0
soupsieve==2.3.2.post1
sqlparse==0.4.2
tablib==3.2.1
telepath==0.2
typing_extensions==4.2.0
Unidecode==1.3.4
urllib3==1.26.9
wagtail==2.9
webencodings==0.5.1
Willow==1.3
xlrd==2.0.1
XlsxWriter==1.4.5
xlwt==1.3.0

@reedjones @realsifocopypaste333 Hello,

This error typically occurs when there is an issue with importing a function or module from a Python package.

In this case, it seems that the longclaw.checkout.templatetags.longclawcheckout_tags module is trying to import the get_real_ip function from the ipware.ip package, but the import is failing.

One possible reason for this error is that the ipware package is not installed or is not up to date. You can try installing or updating it by running pip install ipware or pip install --upgrade ipware in your terminal.

If that doesn't resolve the issue, you can try checking if the get_real_ip function is actually defined in the ipware.ip package. You can do this by opening the ip.py file in the ipware package directory and looking for the get_real_ip function. If it's not defined, then there may be a different package or module that provides the get_real_ip function that you need to install or import instead.

If you're still having trouble, it may be helpful to post the full error message and the relevant code snippets so that others can better understand the issue and provide more specific guidance.

Do we need django-ipware, I see it is used only in settings?

@reedjones @realsifocopypaste333 Hello,

This error typically occurs when there is an issue with importing a function or module from a Python package.

In this case, it seems that the longclaw.checkout.templatetags.longclawcheckout_tags module is trying to import the get_real_ip function from the ipware.ip package, but the import is failing.

One possible reason for this error is that the ipware package is not installed or is not up to date. You can try installing or updating it by running pip install ipware or pip install --upgrade ipware in your terminal.

If that doesn't resolve the issue, you can try checking if the get_real_ip function is actually defined in the ipware.ip package. You can do this by opening the ip.py file in the ipware package directory and looking for the get_real_ip function. If it's not defined, then there may be a different package or module that provides the get_real_ip function that you need to install or import instead.

If you're still having trouble, it may be helpful to post the full error message and the relevant code snippets so that others can better understand the issue and provide more specific guidance.

thank you very much ChatGPT