cooperdk / YAPO-e-plus

YAPO e+ - Yet Another Porn Organizer (extended)
https://github.com/cooperdk/YAPO-e-plus
GNU General Public License v3.0
143 stars 15 forks source link

manage.py AttributeError: module 'memcache' has no attribute 'Client' error during startup #88

Closed humble-b closed 2 years ago

humble-b commented 2 years ago

Describe the bug first start of yapo server, i receive error AttributeError: module 'memcache' has no attribute 'Client' version downloaded using git: 0.7.6.4 (bugfix build 2) running under Ubuntu VERSION="18.04.6 LTS (Bionic Beaver)"

full error: Performing system checks...

Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner self.run() File "/usr/lib/python3.9/threading.py", line 910, in run self._target(*self._args, *self._kwargs) File "/home/alfl/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper fn(args, **kwargs) File "/home/alfl/.local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run self.check(display_num_errors=True) File "/home/alfl/.local/lib/python3.9/site-packages/django/core/management/base.py", line 419, in check all_issues = checks.run_checks( File "/home/alfl/.local/lib/python3.9/site-packages/django/core/checks/registry.py", line 76, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "/home/alfl/.local/lib/python3.9/site-packages/django/core/checks/caches.py", line 63, in check_file_based_cache_is_absolute cache = caches[alias] File "/home/alfl/.local/lib/python3.9/site-packages/django/utils/connection.py", line 62, in getitem conn = self.create_connection(alias) File "/home/alfl/.local/lib/python3.9/site-packages/django/core/cache/init.py", line 44, in create_connection return backend_cls(location, params) File "/home/alfl/.local/lib/python3.9/site-packages/django/core/cache/backends/memcached.py", line 182, in init super().init(server, params, library=memcache, value_not_found_exception=ValueError) File "/home/alfl/.local/lib/python3.9/site-packages/django/core/cache/backends/memcached.py", line 28, in init self._class = library.Client AttributeError: module 'memcache' has no attribute 'Client'

To Reproduce Steps to reproduce the behavior: 1 - create folder ~/projects 2 - cd into folder ~/projects and clone git repo 3 - run pip install -r requirements.txt ( no capital -R as described in readme as this doesn't work ) 4 - open firewall port using: sudo ufw allow 8000/tcp 5 - start yapo using command: python manage.py runserver 127.0.0.1:8000

error received: AttributeError: module 'memcache' has no attribute 'Client'

Expected behavior start of the yapo webserver

Screenshots image

Python version: Python 3.9.7 running under Ubuntu VERSION="18.04.6 LTS (Bionic Beaver)"

Additional context tried to start with and without sudo rights ( so as std user or as root ). Error is the same

cooperdk commented 2 years ago

Apologies for the late answer.

YAPO does not use memcached by default. The error is caused by something not working in your installation as this hasn't been reported earlier.

You can remove the reference to memcached in YAPO/settings.py

Change lines 30 to 42 from:

if not DEBUG or TEST_MEMCACHE:
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': '127.0.0.1:11211',
        }
    }
else:
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
        }
    }

to:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    }
}

Remember to observe the required Python indentation (this project uses tabs)