Permissions in Django makemessages are denied
I’m trying to add i8n to a Django app, but when I execute:
(venv) user@machine:~/path/to/repo$ django-admin makemessages -l es
Throw the next error:
PermissionError: [Errno 13] Permission denied: './venv/lib/python3.5/site-packages/Jinja2-2.9.5.dist-info/LICENSE.txt.py'
But if I use it with manage.py instead of django-admin, it works. In the django documentation, they recommend using django-admin.
Django’s documentation doesn’t really “recommend” using
django-admin instead of
./manage.py – it’s actually < a href="https://docs.djangoproject.com/en/1.10/ref/django-admin/" rel="noreferrer noopener nofollow" > the doc states that :
Generally, when working on a single Django project, it’s easier to use manage.py than django-admin.
The command-line examples throughout this document use django-admin to be consistent, but any example can use manage.py or python -m django just as well.
The reason is:
In addition, manage.py is automatically created in each Django project. manage.py does the same thing as django-admin but takes care of a few things for you:
It puts your project’s package on sys.path.
It sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project’s settings.py file.
Note that in fact the second point is not entirely accurate – .
/manage.py is only set when not
set DJANGO_SETTINGS_MODULE in your environment.
Therefore, when using
django-admin, you must make sure that it finds your settings module (by setting environment variables or passing it > option via –
-settings) and that the root directory of your project is in your pythonpath.
In fact, aside from
the startproject command – by definition, you don’t have
a ./manage.py file yet – there’s no reason to use
django-admin unless you want to explicitly use a different settings module without changing environment variables.