mbi / django-rosetta

Rosetta is a Django application that eases the translation process of your Django projects
MIT License
1.07k stars 195 forks source link

TemplateDoesNotExist at /rosetta/files/project #254

Closed chenluyong closed 3 years ago

chenluyong commented 3 years ago

install django-rosetta in my computer

pip install django-rosetta
Collecting django-rosetta
  Downloading django_rosetta-0.9.5-py3-none-any.whl (104 kB)
     |████████████████████████████████| 104 kB 285 kB/s
Requirement already satisfied: six>=1.2.0 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from django-rosetta) (1.15.0)
Collecting polib>=1.1.0
  Downloading polib-1.1.0-py2.py3-none-any.whl (25 kB)
Requirement already satisfied: requests>=2.1.0 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from django-rosetta) (2.23.0)
Requirement already satisfied: Django>=2.0 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from django-rosetta) (3.0.7)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from requests>=2.1.0->django-rosetta) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from requests>=2.1.0->django-rosetta) (2.9)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from requests>=2.1.0->django-rosetta) (1.25.9)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from requests>=2.1.0->django-rosetta) (3.0.4)
Requirement already satisfied: sqlparse>=0.2.2 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from Django>=2.0->django-rosetta) (0.3.1)
Requirement already satisfied: pytz in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from Django>=2.0->django-rosetta) (2020.1)
Requirement already satisfied: asgiref~=3.2 in c:\users\administrator\appdata\local\programs\python\python38\lib\site-packages (from Django>=2.0->django-rosetta) (3.3.1)
Installing collected packages: polib, django-rosetta
Successfully installed django-rosetta-0.9.5 polib-1.1.0
WARNING: You are using pip version 20.2.2; however, version 21.0.1 is available.
You should consider upgrading via the 'c:\users\administrator\appdata\local\programs\python\python38\python.exe -m pip install --upgrade pip' command.

get some info https://django-rosetta.readthedocs.io/installation.html

configuration rosetta apps into INSTALLED_APP

settings.py look like this

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'myapps',

    'rosetta',
]

urls.py look like this


from django.contrib import admin
from django.urls import path,include
from django.conf import settings

from jsonrpc.backend.django import api
from . import rpc
from tor_ethereum import apscheduler

urlpatterns = [
    path('admin/', admin.site.urls),
    # path('order/', include('order.urls'), name='order'),
    # path('blackcat/', include('blackcat.urls'), name='blackcat'),
    path('tor/', include('tor.urls'), name='tor'),
    path('blockchain/', include('blockchain.urls'), name='blockchain'),
    path('jsonrpc/', include(api.urls)),
]

if 'rosetta' in settings.INSTALLED_APPS:
    from django.urls import re_path
    urlpatterns += [
        re_path(r'^rosetta/', include('rosetta.urls'))
    ]
chenluyong commented 3 years ago

I got the problem solved.

the INSTALLED_APPS should change

look like this

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'rosetta',

    'my_apps',
]

move the app forward.

mbi commented 3 years ago

Most likely a template name conflict between Rosetta and templates defined in my_apps.