Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError at../rosetta/files/project #285

Open
allanon74 opened this issue Jan 25, 2024 · 3 comments
Open

TypeError at../rosetta/files/project #285

allanon74 opened this issue Jan 25, 2024 · 3 comments

Comments

@allanon74
Copy link

Django: 5.0.1
django-rosetta: 0.10.0

I tried to access to the rosetta admin page (through the admin page) and i received that error:

TypeError at /it/rosetta/files/project/
Expected str, bytes or os.PathLike object, not NoneType

traceback

Environment:

Request Method: GET
Request URL: http://leiferstsdjango.leifers.gvcc.net/it/rosetta/files/project/

Django Version: 5.0.1
Python Version: 3.10.12
Installed Applications:
['tabella.apps.TabellaConfig',
'turni.apps.TurniConfig',
'dipendenti.apps.DipendentiConfig',
'valutazioni.apps.ValutazioniConfig',
'pratiche.apps.PraticheConfig',
'helpdesk.apps.HelpdeskConfig',
'accessi.apps.AccessiConfig',
'gic.apps.GicConfig',
'admin_interface',
'colorfield',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'django.forms',
'simple_history',
'webpush',
'rosetta',
'parler',
'fontawesomefree']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.admindocs.middleware.XViewMiddleware',
'simple_history.middleware.HistoryRequestMiddleware']

Traceback (most recent call last):
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/utils/decorators.py", line 48, in _wrapper
return bound_method(*args, **kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/views/decorators/cache.py", line 80, in _view_wrapper
response = view_func(request, *args, **kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/utils/decorators.py", line 48, in _wrapper
return bound_method(*args, **kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
return view_func(request, *args, **kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/rosetta/views.py", line 57, in dispatch
return super(RosettaBaseMixin, self).dispatch(*args, **kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/views/generic/base.py", line 143, in dispatch
return handler(request, *args, **kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/django/views/generic/base.py", line 226, in get
context = self.get_context_data(**kwargs)
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/rosetta/views.py", line 213, in get_context_data
po_paths = find_pos(
File "/home/django/ambienti/laisoft/lib/python3.10/site-packages/rosetta/poutil.py", line 52, in find_pos
os.path.abspath(os.path.dirname(project.file))
File "/usr/lib/python3.10/posixpath.py", line 152, in dirname
p = os.fspath(p)

Exception Type: TypeError at /it/rosetta/files/project/
Exception Value: expected str, bytes or os.PathLike object, not NoneType

@mbi
Copy link
Owner

mbi commented Jan 25, 2024

Hello, Rosetta is trying to find the path of your Django project. I think the problem is that it's missing an __init__.py in the main project dir (i.e. where manage.py lives). I'll look into this, but in the meantime you can probably fix the issue by creating that file.

@mbi
Copy link
Owner

mbi commented Jan 25, 2024

Note to self. project.__file__ is None if the project doesn't have an __init__.py file.
https://github.com/mbi/django-rosetta/blob/develop/rosetta/poutil.py#L52

@allanon74
Copy link
Author

ah ok! Thanks and sorry for the stupid question!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants