0

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.

David Oliver
  • 2,424
  • 1
  • 24
  • 37

1 Answers1

3

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.

julen
  • 4,959
  • 1
  • 23
  • 31
  • Thanks! I now have `File "/srv/www/pootle/project/pootle/checks.py", line 101, in check_redis
    conn_settings = queue.connection.connection_pool.connection_kwargs
    UnboundLocalError: local variable 'queue' referenced before assignment` - perhaps I need to configure a Redis queue? I'll look into this soon. Btw, I found that I needed to use `./manage.py` to get it to execute, but can't edit an answer without changing 6 characters.
    – David Oliver Apr 29 '15 at 21:16
  • 1
    Re. the error you hit, yes you do need Redis, but here the underlying issue is you haven't installed all the required dependencies, more precisely `django-rq`. Please install the deps using `pip install -r requirements/base.txt` – julen Apr 30 '15 at 05:35