简体   繁体   中英

How can I install Pootle using Git?

I'm using Ubuntu 14.04 and am trying to install version 2.7 of Pootle , which I've been told I should do with Git rather than pip, which I think is because this version is not stable and so doesn't have a pip package/is not yet set up for use with pip. But not being familiar with Python (and am not really much of a programmer at all) I am having trouble with intialising the database with manage.py .

So far I have checked out the master branch to /srv/www/pootle/project and upgraded Django in /usr/local/lib/python2.7/dist-packages/django to version 1.7.7 using pip . (See Pootle 2.7 requirements .)

I had previously successfully installed Pootle version 2.5 using pip and the pootle setup to initialise the database, but because Pootle 2.7 has removed the pootle setup command , I've been trying to initialise the database with ./manage.py initdb . That results in:

Traceback (most recent call last):
  File "./manage.py", line 20, in <module>
    cmd_log(*sys.argv)
  File "/srv/www/pootle/project/pootle/core/log.py", line 61, in cmd_log
    fn = settings.LOGGING.get('handlers').get('log_action').get('filename')
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 46, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 115, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

I suppose this is because the Django settings are being used, and not my settings at /srv/www/pootle/pootle.conf which has my secret key and other config.

I've tried using the --settings=pootle option with manage.py and django-admin.py , with a symlink in /usr/local/lib/python2.7/dist-packages/django/ and /usr/local/lib/python2.7/dist-packages/django/conf/ named pootle.settings leading to my pootle.conf , but still get The SECRET_KEY setting must not be empty .

Here the difference is that when you install Pootle via pip, you have available the pootle command, which has a convenience runner that sets things up for you, including the path to the custom settings file. When you use a git clone, the convenience magic is unavailable.

Long story short, you need to set the POOTLE_SETTINGS environment variable to the path of your custom settings file.

$ POOTLE_SETTINGS=/srv/www/pootle/pootle.conf python manage.py initdb

Alternatively, and since you are trying out a git clone, you can rename your settings file to something like 90-custom-settings-local.conf ( 90- is important, as well as the .conf extension; -local is handy as it's in Pootle's .gitignore ) and drop it into pootle/settings/ , and it'll pick it up. No need to set the POOTLE_SETTINGS env var with this method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM