mbi / django-simple-captcha

Django Simple Captcha is an extremely simple, yet highly customizable Django application to add captcha images to any Django form.
http://django-simple-captcha.readthedocs.io/en/latest/
MIT License
1.38k stars 319 forks source link

Package Conflicts With Django-Recaptcha #217

Closed artforlife closed 10 months ago

artforlife commented 1 year ago

Because both django-simple-captcha and django-recaptcha contain all their files in a directory called captcha, there is a way to create a conflict. In particular, if someone uses one of these projects as the captcha tool explicitly, whilst also using another package that uses the other project (captcha tool), pip can override the captcha directory with the unwanted package during installation.

Precisely this happened to me when I tried to put a Django project into Docker. Locally it works fine. However, inside the Docker container, pip overrides the captcha directory with the competing package.

https://github.com/torchbox/django-recaptcha/issues/291

requirements.txt example

django-cms>=3.7,<3.8
djangocms-admin-style>=1.4,<1.5
django-treebeard>=4.0,<5.0

djangocms-text-ckeditor>=3.7,<3.9
djangocms-link>=2.5,<2.6
djangocms-style>=2.2,<2.3
djangocms-googlemap>=1.3,<1.4
djangocms-snippet==2.3
# djangocms-video>=2.1,<2.3
djangocms-file>=2.3,<3.0
djangocms-picture>=2.3,<2.4
djangocms-bootstrap4>=1.5,<1.6
easy_thumbnails
django-filer<=1.7
Django<=2.2.14
django-classy-tags>=0.9
django-sekizai>=1.0,<=2.2.0
django-mptt>0.9
html5lib>=1.0.1
Pillow>=3.0
six
pytz

aldryn-forms==4.0.1
pytils==0.3
django-modeltranslation==0.15
django-rosetta==0.9.4
psycopg2-binary<=2.8.6
django-ckeditor-filebrowser-filer==0.3.0

faker==4.1.0
yandex-checkout==1.6.0
yandex-translater==6.0

django-analytical

django-recaptcha==2.0.6
django-debug-toolbar==2.2

djangocms-attributes-field<=2.1.0
#django-sekizai<=2.2.0
typing_extensions==4.1.1
importlib-metadata==4.8.3
django-classy-tags==2.0.0
l00sed commented 1 year ago

I'm having the same issue. I'd like to use Google reCAPTCHA and django-simple-captcha as the fallback if Google's API somehow becomes unavailable. Most SO threads I've read say that it's pretty much impossible to use two INSTALLED_APPS with the same name.

Is there any recommendations on how one might install both these packages in the same Django project?

koutoftimer commented 10 months ago

@l00sed fork it and use it, for an example.

As has been discussed in djnago-recaptcha django-simple-captcha had to avoid naming conflict because it was born later.

Also, IMHO, all "django batteries" should be prefixed with "django" unless they support other frameworks/work without frameworks.

mbi commented 10 months ago

As has been https://github.com/torchbox/django-recaptcha/issues/291#issuecomment-1752154652 django-simple-captcha had to avoid naming conflict because it was born later.

As I mentioned there, this is incorrect. Django-simple-captcha was first released before Django-recaptcha. That said, you're right: it's not feasible to rename either project, the only way to address this in hindsight is to fork either project and change the name of the Django app.

koutoftimer commented 10 months ago

@mbi thank you for your feedback.

Andrew-Chen-Wang commented 10 months ago

cc @Stormheng

I'm not very good with packaging, but is it not feasible to just... have a second directory that imports everything from the first? Then publish a new package?